[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 00:56:14 UTC 2015
#31355: Custom hierarchical post type 404s when `get_queried_object` is called too
early
--------------------------+------------------------------
Reporter: gradyetc | Owner:
Type: defect (bug) | Status: new
Priority: normal | Milestone: Awaiting Review
Component: Query | Version: 3.0
Severity: normal | Resolution:
Keywords: has-patch | Focuses:
--------------------------+------------------------------
Changes (by jazbek):
* keywords: => has-patch
Comment:
I have also just run into this bug.
As a simple fix, I'm wondering why we're setting `$this->queried_object_id
= 0;` in `$wp_query->get_queried_object()` before we attempt to find the
queried object?
https://github.com/WordPress/WordPress/blob/master/wp-
includes/query.php#L3929
Can we not set it to null, or unset it before we attempt to find it?
Setting it to `0` gives it a value, which seems incorrect if the query
hasn't been run, or if there is no queried object.
As an aside, I found this SO question with a number of people who have run
into this bug, so it's not completely obscure
== ==
:
http://stackoverflow.com/questions/25740115/post-type-hierarchical
--
Ticket URL: <https://core.trac.wordpress.org/ticket/31355#comment:5>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list