WP_Site_Query::set_found_sites() private WP 4.6.0
Populates found_sites and max_num_pages properties for the current query if the limit clause was used.
{} It's a method of the class: WP_Site_Query{}
Hooks from the method
Return
null
. Nothing.
Usage
// private - for code of main (parent) class only $result = $this->set_found_sites();
Notes
- Global. wpdb. $wpdb WordPress database abstraction object.
Changelog
Since 4.6.0 | Introduced. |
Code of WP_Site_Query::set_found_sites() WP Site Query::set found sites WP 5.7.1
private function set_found_sites() {
global $wpdb;
if ( $this->query_vars['number'] && ! $this->query_vars['no_found_rows'] ) {
/**
* Filters the query used to retrieve found site count.
*
* @since 4.6.0
*
* @param string $found_sites_query SQL query. Default 'SELECT FOUND_ROWS()'.
* @param WP_Site_Query $site_query The `WP_Site_Query` instance.
*/
$found_sites_query = apply_filters( 'found_sites_query', 'SELECT FOUND_ROWS()', $this );
$this->found_sites = (int) $wpdb->get_var( $found_sites_query );
}
}