Replace default og:image tag YOAST

Question

I’m trying to replace the default image picked by yoast (featured image) with a custom with the relative og:image:width and og:image:height, but seems a mission impossible!

I tryed with this:

function my_own_og_function() {
    $my_image_url = 'http://www.mywebsite.net/wp-content/uploads/TEST-A.jpg';
    $GLOBALS['wpseo_og']->image( $my_image_url ); // This will echo out the og tag in line with other WPSEO og tags
}
add_action( 'wpseo_opengraph', 'my_own_og_function', 29 );

But yes, the image is replaced, only is without og:image:width and og:image:height

So i’m wondering, is there away to make it possible? Please, i need your help to make this, i have spent all the night trying to achive what i’m looking for… Thanks a lot! 🙂

0
, , ChristianWeb 2 years 2019-12-29T01:29:04-05:00 0 Answers 89 views 0

Leave an answer

Browse
Browse