Title gets rewritten with blank seperator on home
-
If the site tagline/description is blank, SEO will rewrite the title as “Site Home | ” which looks rather dumb. The separator should be left off if the tagline/description is blank.
I added the following function/filter to fix it for now:
function asd_wp_title_filter ( $title, $sep='|', $seplocation='right' ) { if (empty($sep)) return $title; $title = trim($title); if ($seplocation == 'right') { if (substr($title, -1) == $sep) $title = trim(substr($title, 0, -1)); } elseif ($seplocation == 'left') { if (substr($title, 0, 1) == $sep) $title = trim(substr($title, 1)); } else { if (substr($title, -1) == $sep) $title = trim(substr($title, 0, -1)); if (substr($title, 0, 1) == $sep) $title = trim(substr($title, 1)); } return $title; } add_filter( 'wp_title', 'asd_wp_title_filter', 15, 3 ); add_filter( 'aioseop_title', 'asd_wp_title_filter' );
edit: updated function for possible seplocation scenarios. untested though.
https://www.ads-software.com/plugins/all-in-one-seo-pack/
Viewing 10 replies - 1 through 10 (of 10 total)
Viewing 10 replies - 1 through 10 (of 10 total)
- The topic ‘Title gets rewritten with blank seperator on home’ is closed to new replies.