WordPress at a glance
function is not described

WP_Query::get_queried_object_id() WP 1.5.0

Retrieve ID of the current queried object.

This is a method of the class: WP_Query

No Hooks.

Return

Int.

Usage

$WP_Query = new WP_Query();
$var = $WP_Query->get_queried_object_id();

Changelog

Since 1.5.0 Introduced.

Code of WP Query::get queried object id: wp-includes/class-wp-query.php WP 5.2.3

<?php
public function get_queried_object_id() {
	$this->get_queried_object();

	if ( isset( $this->queried_object_id ) ) {
		return $this->queried_object_id;
	}

	return 0;
}