Menu Adam R Brown

WP hooks navigation: Home/browseActions indexFilters index

Source View: comments_pre_query

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
426            * @since 5.3.0
427            * @since 5.6.0 The returned array of comment data is assigned to the `comments` property
428            *              of the current WP_Comment_Query instance.
429            *
430            * @param array|int|null   $comment_data Return an array of comment data to short-circuit WP's comment query,
431            *                                       the comment count as an integer if `$this->query_vars['count']` is set,
432            *                                       or null to allow WP to run its normal queries.
433            * @param WP_Comment_Query $query        The WP_Comment_Query instance, passed by reference.
434            */
435           $comment_data = apply_filters_ref_array( 'comments_pre_query', array( $comment_data, &$this ) );
436
437           if ( null !== $comment_data ) {
438                if ( is_array( $comment_data ) && ! $this->query_vars['count'] ) {
439                     $this->comments = $comment_data;
440                }
441
442                return $comment_data;
443           }
444