WordPress.org

Make WordPress Core

Changeset 31438


Ignore:
Timestamp:
02/12/2015 06:37:06 PM (6 years ago)
Author:
helen
Message:

Posts list table: Add a filter to disable the months dropdown.

It was previously possible to prevent it from displaying by filtering everything out from the results, but if one really doesn't want it, they should be able to short-circuit before the query even runs.

props norcross, SergeyBiryukov.
fixes #30254.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-admin/includes/class-wp-list-table.php

    r31220 r31438  
    510510        global $wpdb, $wp_locale;
    511511
     512        /**
     513         * Filter whether to remove the 'Months' drop-down from the post list table.
     514         *
     515         * @since 4.2.0
     516         *
     517         * @param bool   $disable   Whether to disable the drop-down. Default false.
     518         * @param string $post_type The post type.
     519         */
     520        if ( apply_filters( 'disable_months_dropdown', false, $post_type ) ) {
     521            return;
     522        }
     523
    512524        $months = $wpdb->get_results( $wpdb->prepare( "
    513525            SELECT DISTINCT YEAR( post_date ) AS year, MONTH( post_date ) AS month
Note: See TracChangeset for help on using the changeset viewer.