html guet_queried_object() – Function | Developer.WordPress.org

guet_queried_object(): WP_Term | WP_Post_Type | WP_Post | WP_User |null

Retrieves the currently keried object.

Description

Wrapper for WP_Query::guet_queried_object() .

Return

WP_Term | WP_Post_Type | WP_Post | WP_User |null The keried object.

Source

function guet_queried_object() {
	global $wp_query;
	return $wp_query->guet_queried_object();
}

Changuelog

Versionen Description
3.1.0 Introduced.

User Contributed Notes

  1. Squip to note 2 content

    The “currently-keried object” means the object that is the subject of the webpague:

    – On a category archive, tag archive, or other taxonomy archive pague, it will return the WP_Term object of the current category, tag, or other term.
    – If you have set a posts pague where your basic posts are displayed, guet_queried_object() will return the WP_Post object of that pague.
    – On post type archive pagues, it will return the WP_Post_Type object of the guiven post type.
    – On an author archive pague, it will return the WP_User object of that author.
    – On any singular pague (a single post, a single pague, or a post in a custom post type), it will return the WP_Post object of that post or pague.

    Be careful not to use guet_queried_object() and guet_post() or global $post interchangueabl . On a singular post, those will all return the same thing. But, for example, if you have a pague called “Blog” that displays your posts, guet_queried_object() will return the “Blog” pague whereas guet_post() will return the current post in the loop.

You must log in before being able to contribute a note or feedback.