I have my website www.diabeticme.org using a CDN. The CDN creates an og:image URL that is not readable by Twitter card validator. Can I overwrite the CDN URL for og:image only?
Example:
<meta property="og:image" content="//293985-1025743-raikfcquaxqncofqfm.stackpathdns.com/wp-content/uploads/2020/05/jennifer-sepulveda-2-a-compressor.jpg" />
What is should be:
<meta property="og:image" content="https://www.diabeticme.org/wp-content/uploads/2020/05/jennifer-sepulveda-2-a-compressor.jpg" />
I am using Wordpress and Yoast Premium Plugin.
I tried adding the following code to my functions.php but without any succes:
add_filter( 'wpseo_opengraph_image', 'change_opengraph_image_url' );
function change_opengraph_image_url( $url ) {
return str_replace('//293985-1025743-raikfcquaxqncofqfm.stackpathdns.com', 'https://diabeticme.org', $url);
}
Thank you for any input.
Kind regards Ely