mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2026-06-28 14:20:15 +00:00
Quick Edit: Allow Quick Edit to be disabled for custom post types or taxonomies.
Some custom post types or taxonomies may not need the Quick Edit functionality, in which case adding hidden fields and rendering the form with the data to edit would be redundant. This commit introduces two filters for more granular control: * `quick_edit_enabled_for_post_type` * `quick_edit_enabled_for_taxonomy` Follow-up to [8857], [9083], [9098]. Props garyc40, sabernhardt, mukesh27, costdev, oglekler, wyrfel, peterwilsoncc, faguni22, robinwpdeveloper, webcommsat, johnbillion, azaozz, hellofromTonya, GunGeekATX, Jick, mikeschinkel, jane, nacin, helen, wonderboymusic, DrewAPicture, SergeyBiryukov. Fixes #16502, #19343, #57596. git-svn-id: https://develop.svn.wordpress.org/trunk@56611 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
@@ -1168,7 +1168,12 @@ class WP_Posts_List_Table extends WP_List_Table {
|
||||
}
|
||||
}
|
||||
|
||||
get_inline_data( $post );
|
||||
/** This filter is documented in wp-admin/includes/class-wp-posts-list-table.php */
|
||||
$quick_edit_enabled = apply_filters( 'quick_edit_enabled_for_post_type', true, $post->post_type );
|
||||
|
||||
if ( $quick_edit_enabled ) {
|
||||
get_inline_data( $post );
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1475,7 +1480,17 @@ class WP_Posts_List_Table extends WP_List_Table {
|
||||
__( 'Edit' )
|
||||
);
|
||||
|
||||
if ( 'wp_block' !== $post->post_type ) {
|
||||
/**
|
||||
* Filters whether Quick Edit should be enabled for the given post type.
|
||||
*
|
||||
* @since 6.4.0
|
||||
*
|
||||
* @param bool $enable Whether to enable the Quick Edit functionality. Default true.
|
||||
* @param string $post_type Post type name.
|
||||
*/
|
||||
$quick_edit_enabled = apply_filters( 'quick_edit_enabled_for_post_type', true, $post->post_type );
|
||||
|
||||
if ( $quick_edit_enabled && 'wp_block' !== $post->post_type ) {
|
||||
$actions['inline hide-if-no-js'] = sprintf(
|
||||
'<button type="button" class="button-link editinline" aria-label="%s" aria-expanded="false">%s</button>',
|
||||
/* translators: %s: Post title. */
|
||||
|
||||
Reference in New Issue
Block a user