On this page
get_queried_object_id(): int
Retrieves the ID of the currently queried object.
Description
Wrapper for WP_Query::get_queried_object_id().
Return
int ID of the queried object.
Source
File: wp-includes/query.php. View all references
function get_queried_object_id() {
global $wp_query;
return $wp_query->get_queried_object_id();
}
Related
Uses
| Uses | Description |
|---|---|
| WP_Query::get_queried_object_id() wp-includes/class-wp-query.php | Retrieves the ID of 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_Query::generate_postdata() wp-includes/class-wp-query.php | Generate post data. |
| wp_get_canonical_url() wp-includes/link-template.php | Returns the canonical URL for a post. |
| wp_list_categories() wp-includes/category-template.php | Displays or retrieves the HTML list of categories. |
| WP::register_globals() wp-includes/class-wp.php | Set up the WordPress Globals. |
| WP_Widget_Recent_Posts::widget() wp-includes/widgets/class-wp-widget-recent-posts.php | Outputs the content for the current Recent Posts widget instance. |
| rel_canonical() wp-includes/link-template.php | Outputs rel=canonical for singular queries. |
| wp_get_shortlink() wp-includes/link-template.php | Returns a shortlink for a post, page, attachment, or site. |
| get_page_template() wp-includes/template.php | Retrieves path of page template in current or parent template. |
| is_page_template() wp-includes/post-template.php | Determines whether the current post uses a page 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. |
| redirect_canonical() wp-includes/canonical.php | Redirects incoming links to the proper URL based on the site url. |
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_id