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.

git-svn-id: https://develop.svn.wordpress.org/trunk@31307 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Boone Gorges
2015-01-30 19:17:51 +00:00
parent 2fb8562a97
commit 057c428346
3 changed files with 45 additions and 1 deletions
@@ -944,10 +944,26 @@ class WP_Posts_List_Table extends WP_List_Table {
$hierarchical_taxonomies = array();
$flat_taxonomies = array();
foreach ( $taxonomy_names as $taxonomy_name ) {
/**
* Filters whether the current taxonomy should be shown in the Quick Edit panel.
*
* @since 4.2.0
*
* @param bool $show Whether to show the current taxonomy in Quick Edit.
* Default: true.
* @param string $taxonomy_name Taxonomy name.
* @param string $post_type Post type of current Quick Edit post.
*/
if ( ! apply_filters( 'quick_edit_show_taxonomy', true, $taxonomy_name, $screen->post_type ) ) {
continue;
}
$taxonomy = get_taxonomy( $taxonomy_name );
if ( !$taxonomy->show_ui )
if ( ! $taxonomy->show_in_quick_edit ) {
continue;
}
if ( $taxonomy->hierarchical )
$hierarchical_taxonomies[] = $taxonomy;