WordPress.org

Make WordPress Core

Opened 10 years ago

Last modified 9 months 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 reporter-feedback
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 10 years ago.
19674.diff (803 bytes) - added by wonderboymusic 6 years ago.

Download all attachments as: .zip

Change History (12)

#1 follow-up: @nacin
10 years ago

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

#2 @nacin
9 years ago

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

#3 @SergeyBiryukov
9 years ago

#22653 was marked as a duplicate.

#4 @sirzooro
9 years ago

  • Cc sirzooro added

#5 in reply to: ↑ 1 @chipbennett
8 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
6 years ago

#7 @wonderboymusic
6 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
6 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
5 years ago

  • Keywords close added

#10 @hellofromTonya
9 months ago

  • Keywords reporter-feedback added

This ticket has been marked as a close candidate.

@SergeyBiryukov what do you think? Is this something to fix? Or should it be closed?

Note: See TracTickets for help on using tickets.