Using WordPress ‘quick_edit_show_taxonomy’ PHP filter

The 'quick_edit_show_taxonomy' WordPress PHP filter allows you to customize the visibility of taxonomies in the Quick Edit panel within WordPress.

Usage

To use this filter, add a custom function to your theme’s functions.php or a plugin, and hook it to 'quick_edit_show_taxonomy'.

add_filter( 'quick_edit_show_taxonomy', 'my_custom_function', 10, 3 );

function my_custom_function( $show_in_quick_edit, $taxonomy_name, $post_type ) {
    // Your custom code here
}

Parameters

  • $show_in_quick_edit (bool): Whether to show the current taxonomy in Quick Edit.
  • $taxonomy_name (string): Taxonomy name.
  • $post_type (string): Post type of the current Quick Edit post.

Examples

Hide Category in Quick Edit for Pages

add_filter( 'quick_edit_show_taxonomy', 'hide_category_quick_edit_pages', 10, 3 );

function hide_category_quick_edit_pages( $show_in_quick_edit, $taxonomy_name, $post_type ) {
    if ( 'category' === $taxonomy_name && 'page' === $post_type ) {
        return false;
    }
    return $show_in_quick_edit;
}

This code hides the ‘category’ taxonomy from the Quick Edit panel for Pages.

Show Custom Taxonomy in Quick Edit for Custom Post Type

add_filter( 'quick_edit_show_taxonomy', 'show_custom_taxonomy_quick_edit', 10, 3 );

function show_custom_taxonomy_quick_edit( $show_in_quick_edit, $taxonomy_name, $post_type ) {
    if ( 'my_custom_taxonomy' === $taxonomy_name && 'my_custom_post_type' === $post_type ) {
        return true;
    }
    return $show_in_quick_edit;
}

This code shows the ‘my_custom_taxonomy’ taxonomy in the Quick Edit panel for the ‘my_custom_post_type’ post type.

Hide All Taxonomies in Quick Edit for Posts

add_filter( 'quick_edit_show_taxonomy', 'hide_all_taxonomies_quick_edit_posts', 10, 3 );

function hide_all_taxonomies_quick_edit_posts( $show_in_quick_edit, $taxonomy_name, $post_type ) {
    if ( 'post' === $post_type ) {
        return false;
    }
    return $show_in_quick_edit;
}

This code hides all taxonomies from the Quick Edit panel for Posts.

Hide Tags in Quick Edit for All Post Types

add_filter( 'quick_edit_show_taxonomy', 'hide_tags_quick_edit_all', 10, 3 );

function hide_tags_quick_edit_all( $show_in_quick_edit, $taxonomy_name, $post_type ) {
    if ( 'post_tag' === $taxonomy_name ) {
        return false;
    }
    return $show_in_quick_edit;
}

This code hides the ‘post_tag’ taxonomy (Tags) from the Quick Edit panel for all post types.

Show Custom Taxonomy in Quick Edit for Specific Post Types

add_filter( 'quick_edit_show_taxonomy', 'show_custom_taxonomy_quick_edit_specific_post_types', 10, 3 );

function show_custom_taxonomy_quick_edit_specific_post_types( $show_in_quick_edit, $taxonomy_name, $post_type ) {
    if ( 'my_custom_taxonomy' === $taxonomy_name && in_array( $post_type, array( 'post', 'my_custom_post_type' ) ) ) {
        return true;
    }
    return $show_in_quick_edit;
}

This code shows the ‘my_custom_taxonomy’ taxonomy