Support » Plugin: Yoast SEO » Yoast Title Filter

  • Why has there been no Title Filter for Yoast yet? I feel like I have to battle the plugin every time I want to add a static separator / sitetitle to my website. I’ve tried to filter wp_title() many times but it doesn’t seem to work. Is there a workaround for this?

    function custom_wp_title( $title, $sep ) {
    	global $paged, $page;
    	$siteTitle = get_bloginfo('name');
    	$title .= $siteTitle;
    	if( is_front_page() ){
    		$title = "$title $sep $siteTitle";
    	if(is_archive() && !is_category()){
    		$title = get_the_date('F Y')." $sep $siteTitle";
    	// Add a page number if necessary.
    	if ( $paged >= 2 || $page >= 2 )
    		$title = "$title - " . sprintf( __( 'Page %s' ), max( $paged, $page )) . " $sep $siteTitle";
    	return $title;
    add_filter( 'wp_title', 'custom_wp_title', 10, 2 );

    This seems like this has been a common issue for a very long time now and it’s really surprising that it hasn’t been fixed or made easier to deal with. My Header / Title looks like this:

    <title><?php wp_title('|'); ?></title>

    I’ve tried to remove my filter, alter the wp_title() but it doesn’t add the separator or the sitetitle.

  • The topic ‘Yoast Title Filter’ is closed to new replies.