[wp-trac] [WordPress Trac] #31355: Custom hierarchical post type 404s when `get_queried_object` is called too early

WordPress Trac noreply at wordpress.org
Sat Sep 12 03:36:14 UTC 2015


#31355: Custom hierarchical post type 404s when `get_queried_object` is called too
early
--------------------------+---------------------------
 Reporter:  gradyetc      |       Owner:  boonebgorges
     Type:  defect (bug)  |      Status:  closed
 Priority:  normal        |   Milestone:  4.4
Component:  Query         |     Version:  3.0
 Severity:  normal        |  Resolution:  fixed
 Keywords:  has-patch     |     Focuses:
--------------------------+---------------------------
Changes (by boonebgorges):

 * owner:   => boonebgorges
 * status:  new => closed
 * resolution:   => fixed


Comment:

 In [changeset:"34073"]:
 {{{
 #!CommitTicketReference repository="" revision="34073"
 Better default values in `WP_Query::get_queried_object()`.

 Setting the default value of the `queried_object_id` property to `0` meant
 that, when called early enough in the WP bootstrap, `get_queried_object()`
 could short-circuit the normal query by fooling it into thinking that the
 request was for a page with id 0. Setting the default value to `null`
 instead
 avoids this problem.

 Props gradyetc, jazbek.
 Fixes #31355.
 }}}

--
Ticket URL: <https://core.trac.wordpress.org/ticket/31355#comment:7>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list