钩子文档

admin_comment_types_dropdown

💡 云策文档标注

概述

admin_comment_types_dropdown 是一个 WordPress 过滤器,用于自定义评论列表表格中下拉菜单显示的评论类型。它允许开发者修改或扩展评论类型的选项。

关键要点

  • 过滤器名称:admin_comment_types_dropdown
  • 参数:$comment_types,一个数组,键为评论类型名称,值为对应的标签
  • 默认值:包含 'comment' 和 'pings' 两个评论类型
  • 用途:在 WP_Comments_List_Table::comment_type_dropdown() 方法中调用,用于显示评论类型筛选下拉菜单
  • 引入版本:WordPress 2.7.0

代码示例

$comment_types = apply_filters(
    'admin_comment_types_dropdown',
    array(
        'comment' => __( 'Comments' ),
        'pings'   => __( 'Pings' ),
    )
);

📄 原文内容

Filters the comment types shown in the drop-down menu on the Comments list table.

Parameters

$comment_typesstring[]
Array of comment type labels keyed by their name.

Source

$comment_types = apply_filters(
	'admin_comment_types_dropdown',
	array(
		'comment' => __( 'Comments' ),
		'pings'   => __( 'Pings' ),
	)
);

Changelog

Version Description
2.7.0 Introduced.