Make WordPress Core

Opened 11 years ago

Closed 11 years ago

#20994 closed defect (bug) (duplicate)

wp_title error notice on custom post type archive title with filter

Reported by: thomask's profile thomask Owned by:
Milestone: Priority: normal
Severity: normal Version: 3.4
Component: Posts, Post Types Keywords:
Focuses: Cc:


I have custom post type ( i got there filter by custom taxonomies e.g.

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/</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

   '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

Change History (1)

#1 @SergeyBiryukov
11 years ago

  • Milestone Awaiting Review deleted
  • Resolution set to duplicate
  • Status changed from new to closed
Note: See TracTickets for help on using tickets.