Ecommerce Shopify WordPress Discussion

publish_post calling twice

I created a function to automatically post an updated or published post to Facebook. The code as it is works exactly as expected, see: function enviar_post_facebook() { global $post; $ch = curl_init(); $url = ''; $access_token = '22222222222'; $intro = get_post_meta($post->ID, '_yoast_wpseo_metadesc', true); $link = get_permalink($post->ID); $options = array( CURLOPT_URL => $url, CURLOPT_POST => true, CURLOPT_POSTFIELDS => 'message='.$intro.'&link='.$link.'&access_token='.$access_token, CURLOPT_RETURNTRANSFER => true ); curl_setopt_array($ch, $options); $response = curl_exec($ch); curl_close($ch); } add_action( 'publish_post', 'enviar_post_facebook' ); However, if I insert additional text in the $intro variable, for example: $intro = get_post_meta($post->ID, '_yoast_wpseo_metadesc', true). '#hashtag1 #hashtag2 #hashtag3'; If I do this, Wordpress calls twice, so that the first time it sends a publication to Faebook with only the values of "#hashtag1 #hashtag2 #hashtag3" and the second time it sends it correctly with the meta description and hashtags. I can't understand why this is happening. I've already done several tests to check that the meta description is not empty before calling the Facebook API. Change "publish_post" to "save_post". Anyway, I just add text to my $intro variable that triggers two publications on Facebook. Can someone help me ?
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.