WordPress.org

Make WordPress Core

Opened 8 years ago

Last modified 2 years ago

#19674 reviewing defect (bug)

Do not prefix wp_title() with spaces if $sep is empty

Reported by: SergeyBiryukov Owned by: obenland
Milestone: Future Release Priority: normal
Severity: trivial Version: 2.0
Component: Themes Keywords: has-patch close
Focuses: Cc:

Description

  1. Add wp_title('') to header.php.
  2. Notice two spaces before the title:
    <title>  Hello World</title>
    

This was previously brought up in #7114, but the fix suggested there wasn't backward compatible.

Attachments (2)

19674.patch (429 bytes) - added by SergeyBiryukov 8 years ago.
19674.diff (803 bytes) - added by wonderboymusic 4 years ago.

Download all attachments as: .zip

Change History (11)

#1 follow-up: @nacin
8 years ago

Wondering if one space might still be expected by themes. For example, if bloginfo('name') is used before wp_title();

#2 @nacin
7 years ago

  • Keywords 2nd-opinion added
  • Milestone changed from 3.4 to Future Release

#3 @SergeyBiryukov
7 years ago

#22653 was marked as a duplicate.

#4 @sirzooro
7 years ago

  • Cc sirzooro added

#5 in reply to: ↑ 1 @chipbennett
6 years ago

Replying to nacin:

Wondering if one space might still be expected by themes. For example, if bloginfo('name') is used before wp_title();

Themes should not be putting anything other than <?php wp_title(); ?> inside of the HTML <title></title> tags. Adding bloginfo( 'name' ) should be done via wp_title filter, even in Themes. Note that this is enforced in the Theme Review guidelines, so if that use case the only impediment, I would recommend not holding up this patch because of it.

@wonderboymusic
4 years ago

#7 @wonderboymusic
4 years ago

  • Keywords 2nd-opinion removed
  • Owner set to obenland
  • Status changed from new to reviewing

19674.diff is a refresh after 4.4

#8 @obenland
4 years ago

Hm, I'm not sure how much of an issue this really is in wp_document_title(). If the separator happens to be empty, the double space is only inserted between title parts, never before or after. This seems to be more of an issue with wp_title()'s $prefix content.

Does this need fixing at all? It's not something that is visible in browser tabs, is it?

#9 @swissspidy
2 years ago

  • Keywords close added
Note: See TracTickets for help on using tickets.