WordPress.org

Make WordPress Core

Opened 4 years ago

Closed 4 years ago

Last modified 4 years ago

#19035 closed defect (bug) (duplicate)

PHP notices caused by assumption about get_queried_object()

Reported by: johnbillion Owned by:
Milestone: Priority: normal
Severity: normal Version: 3.3
Component: Template Keywords:
Focuses: Cc:

Description

post_type_archive_title() is used in wp_title() to produce the title for post type archives. The function assumes that get_queried_object() will return the post type object for the current post type archive, but this isn't always the case.

Example: When viewing example.com/my_post_type/?my_taxonomy=my_term, the return value of get_queried_object() is the term object, not the post type object. This causes a PHP notice when post_type_archive_title() attempts to access the label for the post type object, and results in a blank title.

Not sure where best to fix this.

Change History (3)

comment:1 follow-up: @dd324 years ago

See Also: #17662

Possibly Duplicate: #18614

comment:2 in reply to: ↑ 1 @johnbillion4 years ago

  • Resolution set to duplicate
  • Status changed from new to closed

Replying to dd32:

Possibly Duplicate: #18614

Ah yes that's the same issue.

comment:3 @dd324 years ago

  • Milestone Awaiting Review deleted
Note: See TracTickets for help on using tickets.