钩子文档

comments_list_table_query_args

💡 云策文档标注

概述

此文档介绍 comments_list_table_query_args 过滤器,用于在评论列表表中修改评论查询的参数。它允许开发者自定义 get_comments() 函数的参数数组。

关键要点

  • 过滤器名称:comments_list_table_query_args
  • 参数:$args,一个数组,包含 get_comments() 函数的参数,默认值为空字符串
  • 用途:在 WP_Comments_List_Table::prepare_items() 方法中应用,用于过滤评论查询参数
  • 引入版本:WordPress 5.1.0

代码示例

$args = apply_filters( 'comments_list_table_query_args', $args );

注意事项

参数 $args 应遵循 WP_Comment_Query::__construct() 中定义的参数格式,确保查询正确执行。


📄 原文内容

Filters the arguments for the comment query in the comments list table.

Parameters

$argsarray
An array of get_comments() arguments.

More Arguments from get_comments( … $args )

Array or string of arguments. See WP_Comment_Query::__construct() for information on accepted arguments. Default empty string.

Source

$args = apply_filters( 'comments_list_table_query_args', $args );

Changelog

Version Description
5.1.0 Introduced.