get_queried_object() WordPress Function

The get_queried_object() function in WordPress returns the currently-queried object. This object can be a post, a page, a category, or a tag.

get_queried_object() #

Retrieves the currently queried object.


Description

Wrapper for WP_Query::get_queried_object().


Top ↑

Return

(WP_Term|WP_Post_Type|WP_Post|WP_User|null) The queried object.


Top ↑

Source

File: wp-includes/query.php

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


Top ↑

Changelog

Changelog
VersionDescription
3.1.0Introduced.

The content displayed on this page has been created in part by processing WordPress source code files which are made available under the GPLv2 (or a later version) license by theĀ Free Software Foundation. In addition to this, the content includes user-written examples and information. All material is subject to review and curation by the WPPaste.com community.