WordPress at a glance

get_queried_object() WP 1.0

Retrieve the currently-queried object.

Wrapper for WP_Query::get_queried_object().

✈ 1 time = 0.000026s = very fast | 50000 times = 0.06s = speed of light

No Hooks.

Return

Object. Queried object.

Usage

get_queried_object();

Notes

  • Global. WP_Query. $wp_query WordPress Query object.

Changelog

Since 3.1.0 Introduced.

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

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

Related Functions

From tag: query

More from category: Main Query

No comments
        Log In . Register