get_num_queries() WordPress Function

The get_num_queries() function is a built-in WordPress function that allows you to get the number of database queries that have been executed on a WordPress page. This function is useful for debugging purposes, as it can help you identify areas of your code that are making excessive database queries.

get_num_queries() #

Retrieve the number of database queries during the WordPress execution.


Return

(int) Number of database queries.


Top ↑

Source

File: wp-includes/functions.php

function get_num_queries() {
	global $wpdb;
	return $wpdb->num_queries;
}

Top ↑

Changelog

Changelog
VersionDescription
2.0.0Introduced.

The content displayed on this page has been created in part by processing WordPress source code files which are made available under the GPLv2 (or a later version) license by theĀ Free Software Foundation. In addition to this, the content includes user-written examples and information. All material is subject to review and curation by the WPPaste.com community.

Show More
Show More