钩子文档

disable_categories_dropdown

💡 云策文档标注

概述

本文档介绍了 disable_categories_dropdown 过滤器,用于控制是否在文章列表表中移除“Categories”下拉菜单。该过滤器允许开发者根据需求禁用特定文章类型的分类筛选功能。

关键要点

  • disable_categories_dropdown 是一个过滤器,用于决定是否移除文章列表表中的“Categories”下拉菜单。
  • 过滤器接受两个参数:$disable(布尔值,默认为 false)和 $post_type(字符串,文章类型 slug)。
  • 该过滤器在 WordPress 4.6.0 版本中引入,常用于 WP_Posts_List_Table::categories_dropdown() 方法中。

代码示例

if ( false !== apply_filters( 'disable_categories_dropdown', false, $post_type ) ) {

📄 原文内容

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

Parameters

$disablebool
Whether to disable the categories drop-down. Default false.
$post_typestring
Post type slug.

Source

if ( false !== apply_filters( 'disable_categories_dropdown', false, $post_type ) ) {

Changelog

Version Description
4.6.0 Introduced.