WordPress at Your Fingertips

get_queried_object_id() WP 1.0

Retrieve ID of the current queried object.

Wrapper for WP_Query::get_queried_object_id().

1 time — 0.000011 sec (very fast) | 50000 times — 0.02 sec (speed of light) | PHP 7.0.8, WP 4.6

No Hooks.

Return

Int. ID of the queried object.

Usage

get_queried_object_id();

Notes

  • Global. WP_Query. $wp_query WordPress Query object.

Changelog

Since 3.1.0 Introduced.

Code of get_queried_object_id() WP 5.8.1

function get_queried_object_id() {
	global $wp_query;
	return $wp_query->get_queried_object_id();
}

query

Main Query

No comments
    Log In