Hi there!
I take it you’ve migrated from another SEO plugin? The SEO Framework doesn’t support those fields out of the box, and you should change them when you find the time.
Until then, this little snippet (which you can add to your (child-)theme’s functions.php file) will cure most of the titles; but it shouldn’t be relied upon indefinitely. You should use it as a transitional fix until you manually update the titles:
add_filter( 'the_seo_framework_title_from_custom_field', function( $title, $args ) {
$tsf = the_seo_framework();
// Add the title. This is a bit heavy, so we test for it, first.
if ( false !== strpos( $title, '%%title%%' ) ) {
$title = str_replace( '%%title%%', $tsf->get_raw_generated_title( $args ), $title );
}
// Change separators.
$title = str_replace( '%%sep%%', $tsf->get_title_separator(), $title );
// Remove the sitename and pagination. TSF adds this out of the box.
$title = str_replace( [ '%%sitename%%', '%%page%%' ], '', $title );
return $title;
}, 10, 2 );
More examples will be appreciated if you are still finding issues. I might release a full encompassing snippet for public use in the near future, which cover all of Yoast SEO’s title and description placeholders; so a transition will be seamless.
I hope this helps! Cheers 🙂
I for one vote for that ;0)
I’ve forwarded this to GitHub: https://github.com/sybrew/the-seo-framework/issues/420
Thanks for the idea! 🙂
Same problem.
Changing the title in Yoast then deactivating has no effect.
The snippet doesn’t affect Woocommerce and leaves extra |’s between the titles (or on some pages no titles at all and just |||’s).
The “Title Fix” SEO Extension also didn’t do anything.
I second the development of this. Switched from Yoast and am now seeing duplicate Title and Meta Description problems because the variable %%page%% has been dropped causing problems on blog pages.
Edit: Have added the code snippet above and it does work… Thanks for that.
-
This reply was modified 7 years, 2 months ago by
livninctry.