Menu Adam R Brown

WP hooks navigation: Home/browseActions indexFilters index

Source View: widget_comments_args

To save our bandwidth, we show only a snippet of code around each occurence of the hook. View complete file in SVN (without highlighting).

Understanding Source Code

The best way to understand what a hook does is to look at where it occurs in the source code.

Remember, this hook may occur in more than one file. Moreover, the hook's context may change from version to version.

Source View

Line Code
37  * Renders the `core/latest-comments` block on server.
38  *
39  * @param array $attributes The block attributes.
40  *
41  * @return string Returns the post content with latest comments added.
42  */
43 function render_block_core_latest_comments( $attributes = array() ) {
44      // This filter is documented in wp-includes/widgets/class-wp-widget-recent-comments.php.
45      $comments = get_comments(
46           apply_filters(
47                'widget_comments_args',
48                array(
49                     'number'      => $attributes['commentsToShow'],
50                     'status'      => 'approve',
51                     'post_status' => 'publish',
52                )
53           )
54      );
55