钩子文档

disable_months_dropdown

💡 云策文档标注

概述

disable_months_dropdown 是一个 WordPress 过滤器,用于控制是否在文章列表表格中移除“月份”下拉菜单。它允许开发者根据文章类型动态禁用该功能。

关键要点

  • 过滤器名称:disable_months_dropdown
  • 参数:$disable(布尔值,是否禁用下拉菜单,默认 false)和 $post_type(字符串,文章类型)
  • 用途:在 WP_List_Table::months_dropdown() 中调用,用于过滤月份下拉菜单的显示
  • 引入版本:WordPress 4.2.0

代码示例

if ( apply_filters( 'disable_months_dropdown', false, $post_type ) ) {
    // 代码逻辑
}

📄 原文内容

Filters whether to remove the ‘Months’ drop-down from the post list table.

Parameters

$disablebool
Whether to disable the drop-down. Default false.
$post_typestring
The post type.

Source

if ( apply_filters( 'disable_months_dropdown', false, $post_type ) ) {

Changelog

Version Description
4.2.0 Introduced.