On this page
WP_Query::get_queried_object_id(): int
Retrieves the ID of the currently queried object.
Return
int
Source
File: wp-includes/class-wp-query.php. View all references
public function get_queried_object_id() {
$this->get_queried_object();
if ( isset( $this->queried_object_id ) ) {
return $this->queried_object_id;
}
return 0;
}
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 |
|---|---|
| get_queried_object_id() wp-includes/query.php | Retrieves the ID of the currently queried object. |
| get_body_class() wp-includes/post-template.php | Retrieves an array of the class names for the body element. |
| redirect_canonical() wp-includes/canonical.php | Redirects incoming links to the proper URL based on the site url. |
Changelog
| Version | Description |
|---|---|
| 1.5.0 | Introduced. |
© 2003–2022 WordPress Foundation
Licensed under the GNU GPLv2+ License.
https://developer.wordpress.org/reference/classes/wp_query/get_queried_object_id