On this page
get_queried_object(): WP_Term|WP_Post_Type|WP_Post|WP_User|null
Retrieves the currently queried object.
Description
Wrapper for WP_Query::get_queried_object().
Return
WP_Term|WP_Post_Type|WP_Post|WP_User|null The queried object.
Source
File: wp-includes/query.php. View all references
function get_queried_object() {
global $wp_query;
return $wp_query->get_queried_object();
}
Related
Uses
| Uses | Description |
|---|---|
| WP_Query::get_queried_object() wp-includes/class-wp-query.php | Retrieves the currently queried object. |
Used By
| Used By | Description |
|---|---|
| rest_get_queried_resource_route() wp-includes/rest-api.php | Gets the REST route for the currently queried object. |
| WP_Widget_Custom_HTML::widget() wp-includes/widgets/class-wp-widget-custom-html.php | Outputs the content for the current Custom HTML widget instance. |
| get_embed_template() wp-includes/template.php | Retrieves an embed template path in the current or parent template. |
| wp_get_document_title() wp-includes/general-template.php | Returns document title for the current page. |
| get_the_archive_title() wp-includes/general-template.php | Retrieves the archive title based on the queried object. |
| term_description() wp-includes/category-template.php | Retrieves term description. |
| wp_list_categories() wp-includes/category-template.php | Displays or retrieves the HTML list of categories. |
| feed_links_extra() wp-includes/general-template.php | Displays the links to the extra feeds such as category feeds. |
| single_post_title() wp-includes/general-template.php | Displays or retrieves page title for post. |
| wp_title() wp-includes/general-template.php | Displays or retrieves page title for all areas of blog. |
| single_term_title() wp-includes/general-template.php | Displays or retrieves page title for taxonomy term archive. |
| WP::handle_404() wp-includes/class-wp.php | Set the Headers for 404, if nothing is found for requested URL. |
| WP_Widget_Text::widget() wp-includes/widgets/class-wp-widget-text.php | Outputs the content for the current Text widget instance. |
| edit_term_link() wp-includes/link-template.php | Displays or retrieves the edit term link with formatting. |
| get_single_template() wp-includes/template.php | Retrieves path of single template in current or parent template. Applies to single Posts, single Attachments, and single custom post types. |
| get_attachment_template() wp-includes/template.php | Retrieves path of attachment template in current or parent template. |
| get_author_template() wp-includes/template.php | Retrieves path of author template in current or parent template. |
| get_category_template() wp-includes/template.php | Retrieves path of category template in current or parent template. |
| get_tag_template() wp-includes/template.php | Retrieves path of tag template in current or parent template. |
| get_taxonomy_template() wp-includes/template.php | Retrieves path of custom taxonomy term template in current or parent template. |
| get_page_template() wp-includes/template.php | Retrieves path of page template in current or parent template. |
| wp_list_pages() wp-includes/post-template.php | Retrieves or displays a list of pages (or hierarchical post type items) in list (li) format. |
Changelog
| Version | Description |
|---|---|
| 3.1.0 | Introduced. |
© 2003–2022 WordPress Foundation
Licensed under the GNU GPLv2+ License.
https://developer.wordpress.org/reference/functions/get_queried_object