widget_comments_args
Filters the arguments for the Recent Comments widget.
Использование
add_filter( 'widget_comments_args', 'wp_kama_widget_comments_args_filter', 10, 2 );
/**
* Function for `widget_comments_args` filter-hook.
*
* @param array $comment_args An array of arguments used to retrieve the recent comments.
* @param array $instance Array of settings for the current widget.
*
* @return array
*/
function wp_kama_widget_comments_args_filter( $comment_args, $instance ){
// filter...
return $comment_args;
}
- $comment_args(массив)
- An array of arguments used to retrieve the recent comments.
- $instance(массив)
- Array of settings for the current widget.
Список изменений
| С версии 3.4.0 | Введена. |
| С версии 4.9.0 | Added the $instance parameter. |
Где вызывается хук
widget_comments_args
wp-includes/widgets/class-wp-widget-recent-comments.php 104-112
apply_filters( 'widget_comments_args', array( 'number' => $number, 'status' => 'approve', 'post_status' => 'publish', ), $instance )
wp-includes/blocks/latest-comments.php 55-63
apply_filters( 'widget_comments_args', array( 'number' => $attributes['commentsToShow'], 'status' => 'approve', 'post_status' => 'publish', ), array() )