Changeset 50163 for trunk/src/wp-admin/includes/class-wp-list-table.php
- Timestamp:
- 02/02/2021 08:32:42 PM (4 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-admin/includes/class-wp-list-table.php
r50120 r50163 596 596 } 597 597 598 $extra_checks = "AND post_status != 'auto-draft'";599 if ( ! isset( $_GET['post_status'] ) || 'trash' !== $_GET['post_status'] ) {600 $extra_checks .= " AND post_status != 'trash'";601 } elseif ( isset( $_GET['post_status'] ) ) {602 $extra_checks = $wpdb->prepare( ' AND post_status = %s', $_GET['post_status'] );603 }604 605 $months = $wpdb->get_results(606 $wpdb->prepare(607 "608 SELECT DISTINCT YEAR( post_date ) AS year, MONTH( post_date ) AS month609 FROM $wpdb->posts610 WHERE post_type = %s611 $extra_checks612 ORDER BY post_date DESC613 ",614 $post_type615 )616 );617 618 598 /** 619 * Filters t he 'Months' drop-down results.599 * Filters to short-circuit performing the months dropdown query. 620 600 * 621 * @since 3.7.0601 * @since 5.7.0 622 602 * 623 * @param object[] $months Array of the months drop-down query results.624 * @param string $post_type The post type.603 * @param object[]|false $months 'Months' drop-down results. Default false. 604 * @param string $post_type The post type. 625 605 */ 626 $months = apply_filters( 'months_dropdown_results', $months, $post_type ); 606 $months = apply_filters( 'pre_months_dropdown_query', false, $post_type ); 607 608 if ( ! is_array( $months ) ) { 609 $extra_checks = "AND post_status != 'auto-draft'"; 610 if ( ! isset( $_GET['post_status'] ) || 'trash' !== $_GET['post_status'] ) { 611 $extra_checks .= " AND post_status != 'trash'"; 612 } elseif ( isset( $_GET['post_status'] ) ) { 613 $extra_checks = $wpdb->prepare( ' AND post_status = %s', $_GET['post_status'] ); 614 } 615 616 $months = $wpdb->get_results( 617 $wpdb->prepare( 618 " 619 SELECT DISTINCT YEAR( post_date ) AS year, MONTH( post_date ) AS month 620 FROM $wpdb->posts 621 WHERE post_type = %s 622 $extra_checks 623 ORDER BY post_date DESC 624 ", 625 $post_type 626 ) 627 ); 628 629 /** 630 * Filters the 'Months' drop-down results. 631 * 632 * @since 3.7.0 633 * 634 * @param object[] $months Array of the months drop-down query results. 635 * @param string $post_type The post type. 636 */ 637 $months = apply_filters( 'months_dropdown_results', $months, $post_type ); 638 } 627 639 628 640 $month_count = count( $months );
Note: See TracChangeset
for help on using the changeset viewer.