diff --git src/wp-admin/includes/class-wp-posts-list-table.php src/wp-admin/includes/class-wp-posts-list-table.php
index 1944486..4114db6 100644
|
|
class WP_Posts_List_Table extends WP_List_Table { |
944 | 944 | $hierarchical_taxonomies = array(); |
945 | 945 | $flat_taxonomies = array(); |
946 | 946 | 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 $value Whether to display 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 | |
947 | 962 | $taxonomy = get_taxonomy( $taxonomy_name ); |
948 | 963 | |
949 | | if ( !$taxonomy->show_ui ) |
| 964 | if ( ! $taxonomy->show_in_quick_edit ) { |
950 | 965 | continue; |
| 966 | } |
951 | 967 | |
952 | 968 | if ( $taxonomy->hierarchical ) |
953 | 969 | $hierarchical_taxonomies[] = $taxonomy; |
diff --git src/wp-includes/taxonomy.php src/wp-includes/taxonomy.php
index ccaae90..70d2955 100644
|
|
function is_taxonomy_hierarchical($taxonomy) { |
282 | 282 | * * If not set, the default is inherited from public. |
283 | 283 | * - show_tagcloud - Whether to list the taxonomy in the Tag Cloud Widget. |
284 | 284 | * * If not set, the default is inherited from show_ui. |
| 285 | * - show_in_quick_edit - Whether to show the taxonomy in the quick/bulk edit panel. |
| 286 | * * It not set, the default is inherited from show_ui. |
285 | 287 | * - show_admin_column - Whether to display a column for the taxonomy on its post type listing screens. |
286 | 288 | * * Defaults to false. |
287 | 289 | * - meta_box_cb - Provide a callback function for the meta box display. |
… |
… |
function register_taxonomy( $taxonomy, $object_type, $args = array() ) { |
331 | 333 | 'show_in_menu' => null, |
332 | 334 | 'show_in_nav_menus' => null, |
333 | 335 | 'show_tagcloud' => null, |
| 336 | 'show_in_quick_edit' => null, |
334 | 337 | 'show_admin_column' => false, |
335 | 338 | 'meta_box_cb' => null, |
336 | 339 | 'capabilities' => array(), |
… |
… |
function register_taxonomy( $taxonomy, $object_type, $args = array() ) { |
389 | 392 | if ( null === $args['show_tagcloud'] ) |
390 | 393 | $args['show_tagcloud'] = $args['show_ui']; |
391 | 394 | |
| 395 | // If not set, default to the setting for show_ui. |
| 396 | if ( null === $args['show_in_quick_edit'] ) { |
| 397 | $args['show_in_quick_edit'] = $args['show_ui']; |
| 398 | } |
| 399 | |
392 | 400 | $default_caps = array( |
393 | 401 | 'manage_terms' => 'manage_categories', |
394 | 402 | 'edit_terms' => 'manage_categories', |
diff --git tests/phpunit/tests/taxonomy.php tests/phpunit/tests/taxonomy.php
index e7da80a..dc15392 100644
|
|
class Tests_Taxonomy extends WP_UnitTestCase { |
163 | 163 | } |
164 | 164 | |
165 | 165 | /** |
| 166 | * @ticket 26948 |
| 167 | */ |
| 168 | public function test_register_taxonomy_show_in_quick_edit_should_default_to_value_of_show_ui() { |
| 169 | register_taxonomy( 'wptests_tax_1', 'post', array( |
| 170 | 'show_ui' => true, |
| 171 | ) ); |
| 172 | |
| 173 | register_taxonomy( 'wptests_tax_2', 'post', array( |
| 174 | 'show_ui' => false, |
| 175 | ) ); |
| 176 | |
| 177 | $tax_1 = get_taxonomy( 'wptests_tax_1' ); |
| 178 | $this->assertTrue( $tax_1->show_in_quick_edit ); |
| 179 | |
| 180 | $tax_2 = get_taxonomy( 'wptests_tax_2' ); |
| 181 | $this->assertFalse( $tax_2->show_in_quick_edit ); |
| 182 | } |
| 183 | |
| 184 | /** |
166 | 185 | * @ticket 11058 |
167 | 186 | */ |
168 | 187 | function test_registering_taxonomies_to_object_types() { |