problems with the Curl in the save_post

I would like a link outside the site to be recalled after saving a post.
Ho due problemi:

1) Le librerie Curl sono già di per sè lente. Inoltre la funzioni Hooks “save_post” entrano in loop ripetendo la connessione al link diverse volte.

2) WordPress calls the Curl for each action even when you change the page in the backend.

add_action( ‘save_post’, ‘callscript’ );

function callscript( $post_id ) {

if ( wp_is_post_revision( $post_id ) ){
return;
}

$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, “http://mysite.co/script.php”);
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_exec($ch);
curl_close($ch);

}

Read more here:: problems with the Curl in the save_post

Leave a Reply

Your email address will not be published. Required fields are marked *