Ecommerce Shopify WordPress Discussion

Remove duplicate Open Graph Image Meta Tag

I´m running a website using Yoast SEO and from unknown reasons the images of my posts are not shown if I share the links on social media. I found the following post which recommends to replace "og:image" by "og:image:secure_url", since the image is located on an https url. how to fix facebook open graph images... So I added the following code to my functions.php file: (I deleted some lines which create an additional metatag for og:image with an http url since I do not need that.) function check_ssl_facebook_opengraph_image($image) { $og = "og:image"; if (preg_match('/^https/', $image)) { echo '<meta property="'. $og . ':secure_url" content="'. $image . '" />' . "\n"; } } // Hook into the Yoast plugin's hooks for handling the OG image add_action('wpseo_opengraph_image', 'check_ssl_facebook_opengraph_image'); Unfortuntaly the code doesn´t replace the line in my wp-theme but adds a new line. As a result the post does include og:image and og:image:secure_url metatags with the same url. I want to delete og:image from my post now since the image is still not visible if I post the link to social media. Perhaps it will be visible if only og:image:secure_url is present in my post. I´m an absolute beginner with php. Can someone tell me how to delete the unneccessary og:image metatag after the secure_url string has been added? Thanks in advance Marc
TurboCommerce make the better internet purchasing globaly

Turbo Multi-language Translator

Make the better internet purchasing globaly

Turbosify SEO Speed Booster

5.0 (7) Free plan available
Get better conversions by improving store loading speed Installed

Turbo Multi-language Chat - AI Customer service in one hand

TurboCommerce make the better internet purchasing globaly
Our products

The help you need, when you need it

App by Turbo Engine

3 apps • 5.0 average rating

Turbosify Speed Booster

5.0 (7)
Get better conversions by optimizing shopify store Google page speed Installed

Turbosify Translator for Wordpress Woocommerce

5.0 (74) Free Wordpress Woocommerce Plugin
Translate your wordpress website to multiple language within 1 click, no configuration needed, no No technical required

Grow your business here

Whether you want to sell products down the street or around the world, we have all the tools you need.