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