[wp-trac] [WordPress Trac] #18475: get_post_type_object is sometimes passed an array
WordPress Trac
wp-trac at lists.automattic.com
Sun Nov 6 21:10:07 UTC 2011
#18475: get_post_type_object is sometimes passed an array
--------------------------+--------------------
Reporter: t31os_ | Owner:
Type: defect (bug) | Status: new
Priority: normal | Milestone: 3.3
Component: Post Types | Version: 3.2.1
Severity: minor | Resolution:
Keywords: has-patch |
--------------------------+--------------------
Comment (by nacin):
It took me and ethitter quite a while to track this one down.
The issue is _post_format_request(), which hooks into the request filter
and corrects the `post_type` query variable based on the post_format's
object_type setting. object_type is always cast to an array, even if it is
singular.
In the admin, post_type will always be singular wherever we use wp(). So
what we should also do is prevent the callback from overriding the
post_type query variable in the admin.
Finally, this gets extracted into the global namespace via
WP::register_globals(). There's little reason for the query variables to
be extracted back out into the admin namespace when we call wp() on
edit.php and upload.php. Erick tested bypassing the query_vars extraction
in the admin, and nothing seemed to break, but I'm sure some plugin is
doing something terrible there.
Regardless, I agree with [attachment:18475.diff]. One less global to rely
on. I'm also going to fix _post_format_request().
--
Ticket URL: <http://core.trac.wordpress.org/ticket/18475#comment:5>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software
More information about the wp-trac
mailing list