From 2a1f3c4c1f22de7d93b661c97398d636244dda5d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Helen=20Hou-Sand=C3=AD?= Date: Thu, 12 Feb 2015 18:38:29 +0000 Subject: [PATCH] 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. Built from https://develop.svn.wordpress.org/trunk@31438 git-svn-id: http://core.svn.wordpress.org/trunk@31419 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-admin/includes/class-wp-list-table.php | 12 ++++++++++++ wp-includes/version.php | 2 +- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/wp-admin/includes/class-wp-list-table.php b/wp-admin/includes/class-wp-list-table.php index 1152e64e12..94e99c2d35 100644 --- a/wp-admin/includes/class-wp-list-table.php +++ b/wp-admin/includes/class-wp-list-table.php @@ -509,6 +509,18 @@ class WP_List_Table { protected function months_dropdown( $post_type ) { global $wpdb, $wp_locale; + /** + * Filter whether to remove the 'Months' drop-down from the post list table. + * + * @since 4.2.0 + * + * @param bool $disable Whether to disable the drop-down. Default false. + * @param string $post_type The post type. + */ + if ( apply_filters( 'disable_months_dropdown', false, $post_type ) ) { + return; + } + $months = $wpdb->get_results( $wpdb->prepare( " SELECT DISTINCT YEAR( post_date ) AS year, MONTH( post_date ) AS month FROM $wpdb->posts diff --git a/wp-includes/version.php b/wp-includes/version.php index 2ad39dfca0..0dccaac6c8 100644 --- a/wp-includes/version.php +++ b/wp-includes/version.php @@ -4,7 +4,7 @@ * * @global string $wp_version */ -$wp_version = '4.2-alpha-31432'; +$wp_version = '4.2-alpha-31438'; /** * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.