disable_months_dropdownfilter-hookWP 4.2.0

Allows you to remove the month selection drop-down from a post list table.

Usage

add_filter( 'disable_months_dropdown', 'wp_kama_disable_months_dropdown_filter', 10, 2 );

/**
 * Function for `disable_months_dropdown` filter-hook.
 * 
 * @param bool   $disable   Whether to disable the drop-down.
 * @param string $post_type The post type.
 *
 * @return bool
 */
function wp_kama_disable_months_dropdown_filter( $disable, $post_type ){

	// filter...
	return $disable;
}
$disable(true/false)
Whether to remove the drop-down.
Default: false
$post_type(string)
The post type.

Examples

#1 Remove the month selection drop-down for all post types

add_filter( 'disable_months_dropdown', '__return_true' );

#2 Remove the month selection drop-down only for Pages

add_filter( 'disable_months_dropdown', function ( $disable, $post_type ) {
	return $post_type === 'page' ? true : $disable;
}, 10, 2 );

Changelog

Since 4.2.0 Introduced.

Where the hook is called

WP_List_Table::months_dropdown()
disable_months_dropdown
wp-admin/includes/class-wp-list-table.php 723
if ( apply_filters( 'disable_months_dropdown', false, $post_type ) ) {

Where the hook is used in WordPress

Usage not found.