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
392            * Otherwise the filter should return an array of WP_Comment objects.
393            *
394            * @since 5.3.0
395            *
396            * @param array|int|null   $comment_data Return an array of comment data to short-circuit WP's comment query,
397            *                                       the comment count as an integer if `$this->query_vars['count']` is set,
398            *                                       or null to allow WP to run its normal queries.
399            * @param WP_Comment_Query $this         The WP_Comment_Query instance, passed by reference.
400            */
401           $comment_data = apply_filters_ref_array( 'comments_pre_query', array( $comment_data, &$this ) );
402
403           if ( null !== $comment_data ) {
404                return $comment_data;
405           }
406
407           /*
408            * Only use the args defined in the query_var_defaults to compute the key,
409            * but ignore 'fields', which does not affect query results.
410            */