how to show the <meta> values of yoast seo with some function?

Viewed 125

I'm trying to show the metadata that yoast shows without using the get_header (); or wp_head(). For example:

<meta property="og:locale" content="es_ES" />
    <meta property="og:type" content="article" />
    <meta property="og:title" content="Imagen : infografía.........." />
    <meta property="og:description" content="infografía....." />
    <meta property="og:url" content="https://....." />

Tried this but it doesn't work for me:

<? php echo get_post_meta ($ post-> ID, '_yoast_wpseo_metadesc', true); ?>
1 Answers

check this folder : wordpress-seo\src\presenters\open-graph you can see locale-presenter.php

find this code line : (should be line 18)

protected $tag_format = '<meta property="og:locale" content="%s" />';

change like this (I edited as English , you can edit which language you need.)

protected $tag_format = '<meta property="og:locale" content="en_US" />';
Related