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
405            * @since 5.3.0
406            * @since 5.6.0 The returned array of comment data is assigned to the `comments` property
407            *              of the current WP_Comment_Query instance.
408            *
409            * @param array|int|null   $comment_data Return an array of comment data to short-circuit WP's comment query,
410            *                                       the comment count as an integer if `$this->query_vars['count']` is set,
411            *                                       or null to allow WP to run its normal queries.
412            * @param WP_Comment_Query $this         The WP_Comment_Query instance, passed by reference.
413            */
414           $comment_data = apply_filters_ref_array( 'comments_pre_query', array( $comment_data, &$this ) );
415
416           if ( null !== $comment_data ) {
417                if ( is_array( $comment_data ) && ! $this->query_vars['count'] ) {
418                     $this->comments = $comment_data;
419                }
420
421                return $comment_data;
422           }
423