WordPress.org

Make WordPress Core

Opened 5 years ago

Closed 5 years ago

#22653 closed enhancement (duplicate)

Extra spaces in wp_title

Reported by: nbspjr Owned by:
Milestone: Priority: normal
Severity: normal Version:
Component: Template Keywords:
Focuses: Cc:

Description

Greetings.
wp_title adds extra spaces to the title even if separator is set to be empty. The spaces are added on the side where separator's location is set. For example, if I have title "Blog", then wp_title(""); will output " Blog" and wp_title("", "right"); - "Blog ". At this moment I have to call 'wp_title' filter to trim spaces if there is empty separator passed, something like this:

function my_wp_title($title, $sep, $loc) {
  return ( empty($sep) ) ? trim($title) : $title;
}
add_filter('wp_title', 'my_wp_title', 10, 3);

What do you think of enhancing wp_title function to not add spaces if there is an empty separator?

Change History (1)

#1 @SergeyBiryukov
5 years ago

  • Component changed from General to Template
  • Milestone Awaiting Review deleted
  • Resolution set to duplicate
  • Status changed from new to closed

Duplicate of #19674.

Note: See TracTickets for help on using tickets.