WordPress at a glance

get_queried_object_id() WP 1.0

Retrieve ID of the current queried object.

Wrapper for WP_Query::get_queried_object_id().

  • Global. WP_Query. $wp_query Global WP_Query instance.
✈ 1 time = 0.000011s = very fast | 50000 times = 0.02s = speed of light | PHP 7.0.8, WP 4.6

No Hooks.


Int. ID of the queried object.



Code of get queried object id: wp-includes/query.php WP 5.2.2

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

Related Functions

From tag: query

More from category: Main Query

No comments
    Hello, !     Log In . Register