WordPress.org

Make WordPress Core

Opened 4 years ago

Closed 4 years ago

Last modified 4 years ago

#24788 closed defect (bug) (duplicate)

Notice being displayed in page title on taxonomy archive pages

Reported by: ZaneMatthew Owned by:
Milestone: Priority: normal
Severity: normal Version: 3.5.2
Component: Taxonomy Keywords:
Focuses: Cc:

Description

I'm receiving a PHP notice on custom taxonomy archive pages (or when ever is_tax() is set to true). It appears that the line #543 in general-template.php should have an additional check for the $term thats being used.

Below is the code in question:

if ( is_tax() ) {		
	$tax = get_taxonomy( $term->taxonomy );
	$title = single_term_title( $tax->labels->name . $t_sep, false );
}

And this is my current local fix:

if ( is_tax() && $term = get_queried_object() && ! empty( $term ) ) {
    $tax = get_taxonomy( $term->taxonomy );
    $title = single_term_title( $tax->labels->name . $t_sep, false );
}

thoughts?

Change History (3)

#1 @iseulde
4 years ago

  • Component changed from General to Taxonomy

#2 @wonderboymusic
4 years ago

  • Keywords dev-feedback removed
  • Milestone Awaiting Review deleted
  • Resolution set to invalid
  • Status changed from new to closed

Check it now, it does

#3 @SergeyBiryukov
4 years ago

  • Resolution changed from invalid to duplicate

Duplicate of #21394.

Note: See TracTickets for help on using tickets.