Hi,
It’s probably doable, but definitely needs some custom code to fetch the SEO titles. Based on their documentation, something like this may work:
add_filter( 'asl_results', 'asl_get_seo_title', 10, 1 );
function asl_get_seo_title( $results ) {
foreach ($results as $k=>&$r) {
// Get the seo title
$seo_title = get_post_meta($r->id, '_yoast_wpseo_title', true);
// Modify it
if ($seo_title !== false && $seo_title != "")
$r->title = wpseo_replace_vars( $seo_title, get_post($r->id) );
}
return $results;
}
All the best,
Ernest M.
This looks awesome and hope it will help. I am lookin to see where to add this. Just in case I cannot find it, would you be able to let me know?
Sure! Please check this knowledge base for the exact guidelines 🙂
Thank you! This worked beautifully!
Great to hear 🙂
I will keep this snippet in case someone else needs it.
Feel free to rate the plugin if you like it, it is greatly appreciated and helps us a lot! I will mark this as resolved now.
All the best,
Ernest
@wpdreams is seems that the script stopped working. Is there a way to find a fix?
I think that what is happening, is if any of the variables are being used it is using that instead of the text. If there are not variables, it is fine, but if it is set up like this, Contact our team today %%sep%% %%sitename%% it pulls in like that. I hope there is a resolve for this.
Hi,
That sounds like an issue with the wpseo_replace_vars function from the WP Seo plugin, that is the one doing the replacement. The code only gets the SEO title and calls this function (on line 8) to do the replacement for the variables, then uses whatever the function is returning.
You may have to ask the WP Seo support about this. I checked the documentation and there was no change in this function recently, it should work just like it worked before.
All the best,
Ernest