WordPress.org

Make WordPress Core

Opened 6 years ago

Closed 5 years ago

#31557 closed defect (bug) (invalid)

Blog details are misplaced in title tag with "left" separator location

Reported by: johnjamesjacoby Owned by:
Milestone: Priority: normal
Severity: normal Version:
Component: Themes Keywords:
Focuses: Cc:

Description

This is a follow-up to #18548, and a regression introduced in WordPress 4.1 in r30074.

When calling wp_title() with left set as the separator location, blog details are appended without a separator, and the separator is in the wrong location.

<title> | Sample PageWordPress Develop</title>

See also #31078.

Attachments (3)

Screen Shot 2015-03-07 at 11.07.49 AM.png (12.2 KB) - added by johnjamesjacoby 6 years ago.
31557.01.patch (2.3 KB) - added by johnjamesjacoby 6 years ago.
31557.02.patch (2.2 KB) - added by johnjamesjacoby 6 years ago.
Same as .31557.01.patch with improved support for right separator location

Download all attachments as: .zip

Change History (10)

#1 @johnjamesjacoby
6 years ago

31557.01.patch touches a fair amount of code to fix this in a way that is backwards compatible with all core themes and popular plugins. The BuddyPress team has also done a fair amount of research into this over on BuddyPress #6107.

In short, the copy/pasted code from Underscores and the core themes derived from it did not take into account left separator location, since they have all always used right.

On the feedback end of this all, the Underscores blog details portion should probably have been separated from the recent title-tag feature, maybe even on a different ticket to be explicit about the problem it solved. Combining those two changes made this more difficult to debug instead of easier.

Also note the commit message does not mention that wp_title() now has a third output permutation supported by core themes, which required studying up on 4 years worth of discussion to comprehend what the intentions were, and how and why they were not fully met.

Given the complexity and fragility of the wp_title() function, we may want to invest some time in writing a bevy of unit tests to ensure its output remains consistent through-out future modifications being thought through on #31078.

#2 @johnjamesjacoby
6 years ago

Another nit to pick with r30074. Why was a new filter introduced, but the new blog-details title parts are not sent through it? Now that it's in like this, anyone using the new filter still has to use the old filter to manipulate the blog-details that are appended at the end.

I see two filters to do 1 job, and neither are powerful or flexible enough to be universally useful without forcing plugins to fight for ownership in two places now instead of one before.

@johnjamesjacoby
6 years ago

Same as .31557.01.patch with improved support for right separator location

#4 follow-up: @obenland
5 years ago

  • Keywords close added

Before we fix that bug, I think we should rather remove the wp_title() dependency and take step 2 in the process for better document titles, #31078.

#5 in reply to: ↑ 4 @johnjamesjacoby
5 years ago

Replying to obenland:

Before we fix that bug, I think we should rather remove the wp_title() dependency and take step 2 in the process for better document titles, #31078.

Maybe; except this is a clear bug and regression in functionality. I understand we are working towards a better title tag experience, but we have a responsibility to existing installations to repair what's broken also.

#6 @obenland
5 years ago

We could fix it by going forward with #31078 in 4.3.

#7 @swissspidy
5 years ago

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

Closing as wp_title() has now been replaced by better document titles.

Note: See TracTickets for help on using tickets.