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