WP_Query::get_queried_object_id() WordPress Method
The WP_Query::get_queried_object_id() method is used to get the current post, page, or custom post type ID.
WP_Query::get_queried_object_id() #
Retrieves the ID of the currently queried object.
Return
(int)
Source
File: wp-includes/class-wp-query.php
public function get_queried_object_id() {
$this->get_queried_object();
if ( isset( $this->queried_object_id ) ) {
return $this->queried_object_id;
}
return 0;
}
Expand full source codeCollapse full source codeView on TracView on GitHub
Changelog
| Version | Description |
|---|---|
| 1.5.0 | Introduced. |