diff --git src/wp-admin/includes/class-wp-posts-list-table.php src/wp-admin/includes/class-wp-posts-list-table.php
index ce68efc..8e7f99e 100644
|
|
class WP_Posts_List_Table extends WP_List_Table { |
415 | 415 | * @global int $cat |
416 | 416 | * @param string $which |
417 | 417 | */ |
418 | | protected function extra_tablenav( $which ) { |
| 418 | |
| 419 | /** |
| 420 | * Display categories dropdown for filtering items |
| 421 | * |
| 422 | * @since 4.4.3 |
| 423 | * @access protected |
| 424 | * |
| 425 | * @global int $cat |
| 426 | * |
| 427 | * @param string $post_type |
| 428 | */ |
| 429 | protected function categories_dropdown( $post_type ) { |
419 | 430 | global $cat; |
| 431 | |
| 432 | /** |
| 433 | * Filter whether to remove the 'Categories' drop-down from the post list table. |
| 434 | * |
| 435 | * @since 4.4.3 |
| 436 | * |
| 437 | * @param bool $disable Whether to disable the drop-down. Default false. |
| 438 | * @param string $post_type The post type. |
| 439 | */ |
| 440 | if ( apply_filters( 'disable_categories_dropdown', false, $post_type ) ) { |
| 441 | return; |
| 442 | } |
| 443 | |
| 444 | if ( is_object_in_taxonomy( $post_type, 'category' ) ) { |
| 445 | $dropdown_options = array( |
| 446 | 'show_option_all' => get_taxonomy( 'category' )->labels->all_items, |
| 447 | 'hide_empty' => 0, |
| 448 | 'hierarchical' => 1, |
| 449 | 'show_count' => 0, |
| 450 | 'orderby' => 'name', |
| 451 | 'selected' => $cat |
| 452 | ); |
| 453 | |
| 454 | echo '<label class="screen-reader-text" for="cat">' . __( 'Filter by category' ) . '</label>'; |
| 455 | wp_dropdown_categories( $dropdown_options ); |
| 456 | } |
| 457 | } |
| 458 | |
| 459 | /** |
| 460 | * @param string $which |
| 461 | */ |
| 462 | protected function extra_tablenav( $which ) { |
420 | 463 | ?> |
421 | 464 | <div class="alignleft actions"> |
422 | 465 | <?php |
423 | 466 | if ( 'top' === $which && !is_singular() ) { |
424 | 467 | |
425 | 468 | $this->months_dropdown( $this->screen->post_type ); |
426 | | |
427 | | if ( is_object_in_taxonomy( $this->screen->post_type, 'category' ) ) { |
428 | | $dropdown_options = array( |
429 | | 'show_option_all' => get_taxonomy( 'category' )->labels->all_items, |
430 | | 'hide_empty' => 0, |
431 | | 'hierarchical' => 1, |
432 | | 'show_count' => 0, |
433 | | 'orderby' => 'name', |
434 | | 'selected' => $cat |
435 | | ); |
436 | | |
437 | | echo '<label class="screen-reader-text" for="cat">' . __( 'Filter by category' ) . '</label>'; |
438 | | wp_dropdown_categories( $dropdown_options ); |
439 | | } |
| 469 | $this->categories_dropdown( $this->screen->post_type ); |
440 | 470 | |
441 | 471 | /** |
442 | 472 | * Fires before the Filter button on the Posts and Pages list tables. |