WP_Query::get_queried_object_id()publicWP 1.5.0

Retrieves the ID of the currently queried object.

Метод класса: WP_Query{}

Хуков нет.

Возвращает

int.

Использование

global $wp_query;
$wp_query->get_queried_object_id();

Список изменений

С версии 1.5.0 Введена.

Код WP_Query::get_queried_object_id() WP 6.6.1

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

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

	return 0;
}