WordPress.org

Make WordPress Core


Ignore:
Timestamp:
01/30/2015 07:17:51 PM (7 years ago)
Author:
boonebgorges
Message:

Introduce 'show_in_quick_edit' parameter for register_taxonomy().

Setting 'show_in_quick_edit' to false when registering a custom taxonomy will
hide the taxonomy when editing posts using Quick Edit.

The new 'quick_edit_show_taxonomy' filter allows this behavior to be filtered
on a finer scale, as when you want a given taxonomy to be hidden for one post
type but not for others.

Props hlashbrooke.
Fixes #26948.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-admin/includes/class-wp-posts-list-table.php

    r31220 r31307  
    945945        $flat_taxonomies = array();
    946946        foreach ( $taxonomy_names as $taxonomy_name ) {
     947
     948            /**
     949             * Filters whether the current taxonomy should be shown in the Quick Edit panel.
     950             *
     951             * @since 4.2.0
     952             *
     953             * @param bool   $show          Whether to show the current taxonomy in Quick Edit.
     954             *                              Default: true.
     955             * @param string $taxonomy_name Taxonomy name.
     956             * @param string $post_type     Post type of current Quick Edit post.
     957             */
     958            if ( ! apply_filters( 'quick_edit_show_taxonomy', true, $taxonomy_name, $screen->post_type ) ) {
     959                continue;
     960            }
     961
    947962            $taxonomy = get_taxonomy( $taxonomy_name );
    948963
    949             if ( !$taxonomy->show_ui )
     964            if ( ! $taxonomy->show_in_quick_edit ) {
    950965                continue;
     966            }
    951967
    952968            if ( $taxonomy->hierarchical )
Note: See TracChangeset for help on using the changeset viewer.