Shortcodes not working in Yoast Open Graph Meta
June 16, 2020 4:12 pm Leave your thoughtsYoast SEO v14.0 deprecates several actions, hooks, and filters including wpseo_opengraph
If you want to fix up your shortcodes in try this code:
// run shorcodes Yoast OG title & Desc
function run_short_codes_in_og_meta($presentation)
{
$presentation->open_graph_title = do_shortcode(get_post_meta(get_the_ID(), ‘_yoast_wpseo_title’, true));
$presentation->open_graph_description = do_shortcode(get_post_meta(get_the_ID(), ‘_yoast_wpseo_metadesc’, true));
return $presentation;
}
add_filter(‘wpseo_frontend_presentation’, ‘run_short_codes_in_og_meta’, 200);
Categorised in: Web Development
This post was written by WillyNilly