get_queried_object_id() WordPress Function
The get_queried_object_id() function is used to get the current object ID. This can be useful when you need to know the ID of the current object, such as when you need to get the ID of the current post.
get_queried_object_id() #
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
function get_queried_object_id() { global $wp_query; return $wp_query->get_queried_object_id(); }
Expand full source codeCollapse full source codeView on TracView on GitHub
Changelog
Version | Description |
---|---|
3.1.0 | Introduced. |