Filter hook 'pre_months_dropdown_query'

in WP Core File wp-admin/includes/class-wp-list-table.php at line 728

View Source

pre_months_dropdown_query

Filter Hook
Description
Filters whether to short-circuit performing the months dropdown query.

Hook Information

File Location wp-admin/includes/class-wp-list-table.php View on GitHub
Hook Type Filter
Line Number 728

Hook Parameters

Type Name Description
object[]|false $months 'Months' drop-down results. Default false.
string $post_type The post type.

Usage Examples

Basic Usage
<?php
// Hook into pre_months_dropdown_query
add_filter('pre_months_dropdown_query', 'my_custom_filter', 10, 2);

function my_custom_filter($months, $post_type) {
    // Your custom filtering logic here
    return $months;
}

Source Code Context

wp-admin/includes/class-wp-list-table.php:728 - How this hook is used in WordPress core
<?php
 723  		 * @since 5.7.0
 724  		 *
 725  		 * @param object[]|false $months   'Months' drop-down results. Default false.
 726  		 * @param string         $post_type The post type.
 727  		 */
 728  		$months = apply_filters( 'pre_months_dropdown_query', false, $post_type );
 729  
 730  		if ( ! is_array( $months ) ) {
 731  			$extra_checks = "AND post_status != 'auto-draft'";
 732  			if ( ! isset( $_GET['post_status'] ) || 'trash' !== $_GET['post_status'] ) {
 733  				$extra_checks .= " AND post_status != 'trash'";

PHP Documentation

<?php
/**
		 * Filters whether to short-circuit performing the months dropdown query.
		 *
		 * @since 5.7.0
		 *
		 * @param object[]|false $months   'Months' drop-down results. Default false.
		 * @param string         $post_type The post type.
		 */
Quick Info
  • Hook Type: Filter
  • Parameters: 2
  • File: wp-admin/includes/class-wp-list-table.php
Related Hooks

Related hooks will be displayed here in future updates.