Exciting News! Flipper Code is now WePlugins! Same commitment to excellence, brand new identity.

How to use quick_edit_show_taxonomy filter in WordPress

Sandeep Kumar Mishra
Sandeep Kumar Mishra
October 1, 2022
5 minutes read

In WordPress, hooks are a powerful way to extend the functionality of your website without modifying core files. One such hook is the quick_edit_show_taxonomy filter. This filter allows you to control whether a specific taxonomy should be shown in the Quick Edit panel. Let’s dive into how you can use this hook effectively in your WordPress site.

quick_edit_show_taxonomy filter

The quick_edit_show_taxonomy filter determines if the current taxonomy should appear in the Quick Edit panel. To use this filter, you first need to register it using add_filter. This can be done in your theme’s functions.php file or a custom WordPress plugin. At WePlugins, we recommend creating a custom plugin to ensure nothing breaks during theme updates.

Below are the parameters required to use this hook:

  • $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.

Live Examples

Example 1: Hide Tags from Quick Edit for Non-Admins

In this example, we will hide the tags from the Quick Edit panel for users who do not have admin privileges.

/**
     * Hide tags from quick edit if user does not have admin privileges
     */
    function weplugins_hide_tags_from_quick_edit( $show_in_quick_edit, $taxonomy_name, $post_type ) {
        if ( 'post_tag' === $taxonomy_name && ! current_user_can( 'manage_options' ) ) {
            return false;
        } else {
            return $show_in_quick_edit;
        }
    }
    add_filter( 'quick_edit_show_taxonomy', 'weplugins_hide_tags_from_quick_edit', 10, 3 );

Example 2: Modify Quick Edit Show Taxonomy Defaults

Here’s a basic example of how you can modify the quick_edit_show_taxonomy filter according to your website’s requirements.

    function weplugins_modify_quick_edit_show_taxonomy_defaults($show_in_quick_edit, $taxonomy_name, $post_type) { 
        // Update the $show_in_quick_edit variable according to your website requirements.
        return $show_in_quick_edit; 
    }
    // Add the filter
    add_filter( 'quick_edit_show_taxonomy', 'weplugins_modify_quick_edit_show_taxonomy_defaults', 10, 3 );

Example 3: Remove Quick Edit Show Taxonomy Filter

If you need to remove a registered hook, you can use remove_filter. Make sure to provide the same callback function name, priority, and number of arguments.

remove_filter( 'quick_edit_show_taxonomy', 'weplugins_modify_quick_edit_show_taxonomy_defaults', 10, 3 );

Access Premium WordPress Plugins

Contact Us

If you need any customization or assistance with this hook, feel free to contact us. Our team at WePlugins is always here to help you with your WordPress needs.

Sandeep Kumar Mishra

Sandeep Kumar Mishra

Sandeep Kumar Mishra writes about WordPress and Artificial Intelligence, offering tips and guides to help you master your website and stay updated with the latest tech trends.

Explore the latest in WordPress

Trying to stay on top of it all? Get the best tools, resources and inspiration sent to your inbox every Wednesday.