[Solved] WordPress – different post title on frontend than in url [closed]


If I understand what you want correctly, you can place this code in the functions.php of your theme

function set_my_seo_title($title, $id)
{
    global $post;
    $seo_title=get_post_meta($id, '_yoast_wpseo_title', true);         
    return ((!empty($seo_title)&&$post->post_type=='post') ? $seo_title : $title);
}

add_filter('the_title', 'set_my_seo_title', 15, 2);

This will check if post got SEO title set. If yes, it will be used, if no – it will use regular post title.

8

solved WordPress – different post title on frontend than in url [closed]