Make WordPress Core

Opened 13 years ago

Closed 11 years ago

#16632 closed defect (bug) (fixed)

Template title tags shouldn't ignore the prefix,even if 'display' is false

Reported by: yoavf's profile yoavf Owned by: nacin's profile nacin
Milestone: 3.7 Priority: normal
Severity: minor Version: 3.1
Component: Template Keywords: has-patch
Focuses: Cc:


Some template title tags that accept both the $prefix and $display paramater ignore the prefix if the display is set to false, i.e. single_post_title(), single_term_title().

Some don't, i.e. single_month_title().

It doesn't make sense to ignore the prefix - if the developer doesn't want it, he can leave it empty.

Attachments (2)

stop-ignoring-prefix.patch (993 bytes) - added by yoavf 13 years ago.
16632.aug-8-2013.diff (1.1 KB) - added by yoavf 11 years ago.

Download all attachments as: .zip

Change History (8)

#1 @TheSteelRat
13 years ago

Yes, I have detected the same bug. The prefix must be also included if display is set to false.

#2 @vaxace
11 years ago

  • Cc vaxace added
  • Keywords needs-refresh added

This is still an issue in WordPress V3.5.2.
In wp-includes/general-template.php at line 635 there is an if statement testing the $display argument. If $display is true, $prefix and $title are echoed. If $display is false, only $title is echoed.

if ( $display )
  echo $prefix . $title;
   return $title; // Should be return $prefix . $title;

Additional instances of this logic error that I have come across:

  • post_type_archive_title() in wp-includes/general-template.php at line 660
  • single_term_title() in wp-includes/general-template.php at line 743
  • single_cat_title() because it calls single_term_title()
  • single_tag_title() because it calls single_term_title()
Last edited 11 years ago by vaxace (previous) (diff)

11 years ago


#3 follow-up: @yoavf
11 years ago

  • Keywords needs-refresh removed
  • Milestone changed from Awaiting Review to 3.7

#4 in reply to: ↑ 3 @desrosj
11 years ago

Works great for me.

#5 @desrosj
11 years ago

  • Cc desrosj@… added

#6 @nacin
11 years ago

  • Owner set to nacin
  • Resolution set to fixed
  • Status changed from new to closed

In 25041:

Obey $prefix when $display = false in single_term_title(), single_post_title(), and post_type_archive_title(). props yoavf, fixes #16632.

Note: See TracTickets for help on using tickets.