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.

Return

Int. ID of the queried object.

Usage

get_queried_object_id();

Code of get_queried_object_id: wp-includes/query.php VER 5.0.1

<?php
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