get_num_queries

Retrieve the number of database queries during the WordPress execution.

Description

(int) get_num_queries(); 

Returns (int)

Number of database queries.


Usage

  1. if ( !function_exists( 'get_num_queries' ) ) { 
  2. require_once ABSPATH . WPINC . '/functions.php'; 
  3.  
  4.  
  5. // NOTICE! Understand what this does before running. 
  6. $result = get_num_queries(); 
  7.  

Defined (1)

The function is defined in the following location(s).

/wp-includes/functions.php  
  1. function get_num_queries() { 
  2. global $wpdb; 
  3. return $wpdb->num_queries;