widget_comments_args
Filters the arguments for the Recent Comments widget.
Description
Parameters (1)
- 0. $array — Optional. (callback) =>
array( 'number' => $number, 'status' => 'approve', 'post_status' => 'publish' )
- An array of arguments used to retrieve the recent comments.
Usage
- To run the hook, copy the example below.
- $array = apply_filters( 'widget_comments_args', $array );
- if ( !empty( $array ) ) {
- // everything has led up to this point...
- }
- The following example is for adding a hook callback.
- // define the widget_comments_args callback
- function filter_widget_comments_args( $array ) {
- // make filter magic happen here...
- return $array;
- };
- // add the filter
- add_filter( 'widget_comments_args', 'filter_widget_comments_args', 10, 1 );
- To remove a hook callback, use the example below.
- // remove the filter
- remove_filter( 'widget_comments_args', 'filter_widget_comments_args', 10, 1 );
Defined (1)
The filter is defined in the following location(s).
- /wp-includes/widgets/class-wp-widget-recent-comments.php
- $comments = get_comments( apply_filters( 'widget_comments_args', array(