Filter hook 'found_comments_query'

in WP Core File wp-includes/class-wp-comment-query.php at line 1013

View Source

found_comments_query

Filter Hook
Description
Filters the query used to retrieve found comment count.

Hook Information

File Location wp-includes/class-wp-comment-query.php View on GitHub
Hook Type Filter
Line Number 1013

Hook Parameters

Type Name Description
string $found_comments_query SQL query. Default 'SELECT FOUND_ROWS()'.
WP_Comment_Query $comment_query The `WP_Comment_Query` instance.

Usage Examples

Basic Usage
<?php
// Hook into found_comments_query
add_filter('found_comments_query', 'my_custom_filter', 10, 2);

function my_custom_filter($found_comments_query, $comment_query) {
    // Your custom filtering logic here
    return $found_comments_query;
}

Source Code Context

wp-includes/class-wp-comment-query.php:1013 - How this hook is used in WordPress core
<?php
1008  			 * @since 4.4.0
1009  			 *
1010  			 * @param string           $found_comments_query SQL query. Default 'SELECT FOUND_ROWS()'.
1011  			 * @param WP_Comment_Query $comment_query        The `WP_Comment_Query` instance.
1012  			 */
1013  			$found_comments_query = apply_filters( 'found_comments_query', 'SELECT FOUND_ROWS()', $this );
1014  
1015  			$this->found_comments = (int) $wpdb->get_var( $found_comments_query );
1016  		}
1017  	}
1018  

PHP Documentation

<?php
/**
			 * Filters the query used to retrieve found comment count.
			 *
			 * @since 4.4.0
			 *
			 * @param string           $found_comments_query SQL query. Default 'SELECT FOUND_ROWS()'.
			 * @param WP_Comment_Query $comment_query        The `WP_Comment_Query` instance.
			 */
Quick Info
  • Hook Type: Filter
  • Parameters: 2
  • File: wp-includes/class-wp-comment-query.php
Related Hooks

Related hooks will be displayed here in future updates.