[wp-trac] [WordPress Trac] #17662: PHP Notices in get_body_class() for certain query conditions
WordPress Trac
wp-trac at lists.automattic.com
Thu Jun 2 11:09:45 UTC 2011
#17662: PHP Notices in get_body_class() for certain query conditions
--------------------------+-----------------------------
Reporter: dd32 | Owner:
Type: defect (bug) | Status: new
Priority: normal | Milestone: Awaiting Review
Component: Query | Version: 3.2
Severity: normal | Keywords:
--------------------------+-----------------------------
get_body_class() uses get_queried_object(), however, expects that the
returned object will be the same as the conditional it's testing.
For example: {{{/author/admin/?cat=1}}} triggers is_author() and
is_category(), however, queried_object() will be a Category object.
get_body_class() checks to see if is_author() before is_category() and as
a result, attempts to use a Category object as a Author object.
The solution here is to have the same setting order in all locations (ie.
In the code that sets queried_object, and code which iterates through
conditionals and then expects to use the queried object).
Another alternative is to call get_userdata() / get_term() instead of
relying upon the queried object.
Relying upon the queried object has the obvious downside at present that
it can only contain a single object, whereas, WordPress can recieve a
request made up of "multiple objects".
--
Ticket URL: <http://core.trac.wordpress.org/ticket/17662>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software
More information about the wp-trac
mailing list