[wp-trac] [WordPress Trac] #65400: WP_Query::get_queried_object() documented return values are incorrect

WordPress Trac noreply at wordpress.org
Wed Jun 3 11:35:50 UTC 2026


#65400: WP_Query::get_queried_object() documented return values are incorrect
--------------------------+-----------------------------
 Reporter:  tommusrhodus  |      Owner:  (none)
     Type:  defect (bug)  |     Status:  new
 Priority:  normal        |  Milestone:  Awaiting Review
Component:  Comments      |    Version:
 Severity:  normal        |   Keywords:
  Focuses:                |
--------------------------+-----------------------------
 https://github.com/WordPress/wordpress-develop/blob/trunk/src/wp-includes
 /class-wp-query.php#L3966

 Return values are stated as `WP_Term|WP_Post_Type|WP_Post|WP_User|null`
 however it's also possible for this method to return `false`. When `null`
 is passed to `get_userdata`, the return is `false`, this is then returned
 from the `get_queried_object` method itself:

 https://github.com/WordPress/wordpress-develop/blob/trunk/src/wp-includes
 /class-wp-query.php#L4050

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/65400>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list