Opened 13 years ago
Closed 13 years ago
#20994 closed defect (bug) (duplicate)
wp_title error notice on custom post type archive title with filter
Reported by: |
|
Owned by: | |
---|---|---|---|
Milestone: | Priority: | normal | |
Severity: | normal | Version: | 3.4 |
Component: | Posts, Post Types | Keywords: | |
Focuses: | Cc: |
Description
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
#18614, #19035