get_queried_object

Retrieve the currently-queried object.

Description

(object) get_queried_object(); 

Wrapper for WP_Query::get_queried_object().

Returns (object)

Queried object.


Usage

  1. if ( !function_exists( 'get_queried_object' ) ) { 
  2. require_once ABSPATH . WPINC . '/query.php'; 
  3.  
  4.  
  5. // NOTICE! Understand what this does before running. 
  6. $result = get_queried_object(); 
  7.  

Defined (1)

The function is defined in the following location(s).

/wp-includes/query.php  
  1. function get_queried_object() { 
  2. global $wp_query; 
  3. return $wp_query->get_queried_object();