[wp-trac] [WordPress Trac] #20994: wp_title error notice on custom post type archive title with filter
WordPress Trac
wp-trac at lists.automattic.com
Sat Jun 16 21:05:47 UTC 2012
#20994: wp_title error notice on custom post type archive title with filter
--------------------------+-----------------------------
Reporter: thomask | Owner:
Type: defect (bug) | Status: new
Priority: normal | Milestone: Awaiting Review
Component: Post Types | Version: 3.4
Severity: normal | Keywords:
--------------------------+-----------------------------
I have custom post type (http://money.mediacentrum.cz/reference/)and i got
there filter by custom taxonomies e.g.
http://money.mediacentrum.cz/reference/?kraj=&produkt=money-s3&branze=
in the TITLE i got standard <?php wp_title(); ?>, which works normaly on
custom post type archive, but throws error notice on the page filtered by
taxonomies:
Notice</b>: Undefined property: stdClass::$labels in
<b>/var/www/vhosts/money.cz/httpdocs/wp-includes/general-template.php</b>
on line <b>665</b>
problem is with get_queried_object() function, which do not populate the
labels field, but just from that filter, e.g. in this case
{{{
stdClass::__set_state(array(
'term_id' => '7',
'name' => 'Money S3',
'slug' => 'money-s3',
'term_group' => '0',
'term_taxonomy_id' => '227',
'taxonomy' => 'produkt',
'description' => '',
'parent' => '0',
'count' => '118',
))
}}}
I'm quite sure, i am doing it right, but even if not, the function should
not throw an error notice.
I'm going to solve it with something like
{{{
(isset (get_queried_object()->labels))?
get_queried_object()->labels->name : get_queried_object()->name
}}}
but imo even labels should be populated
--
Ticket URL: <http://core.trac.wordpress.org/ticket/20994>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software
More information about the wp-trac
mailing list