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().

1 time = 0.000011s = very fast | 50000 times = 0.02s = 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.5.1

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

From tag: query

More from category: Main Query

No comments
    Log In . Register