钩子文档

pre_months_dropdown_query

💡 云策文档标注

概述

pre_months_dropdown_query 是一个 WordPress 过滤器,用于控制是否跳过执行月份下拉查询。它允许开发者自定义或绕过默认的月份数据获取过程。

关键要点

  • 过滤器名称:pre_months_dropdown_query
  • 参数:$months(数组或 false,默认 false)和 $post_type(字符串)
  • 用途:在 WP_List_Table::months_dropdown() 中调用,用于过滤列表表格中的月份下拉数据
  • 引入版本:WordPress 5.7.0

代码示例

$months = apply_filters( 'pre_months_dropdown_query', false, $post_type );

📄 原文内容

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

Parameters

$monthsobject[]|false
'Months' drop-down results. Default false.
$post_typestring
The post type.

Source

$months = apply_filters( 'pre_months_dropdown_query', false, $post_type );

Changelog

Version Description
5.7.0 Introduced.