mcarpi
Forum Replies Created
Viewing 3 replies - 1 through 3 (of 3 total)
-
Hei @bogdancss, no I couldn’t figure it out, but I’m pretty sure it’s a hosting problem.
I tested the same setup on a different hosting and it works fine.
M
Forum: Developing with WordPress
In reply to: save_post hook fires many times on each updateha I figured the function parameter in remove action had to be a string, so:
remove_action(‘save_post’, ‘trigger_build’);
By doing that I limited it to only 2 requests. It would be great to even get to just 1, but I’m already quite happy.
??
Forum: Developing with WordPress
In reply to: save_post hook fires many times on each updateHey thanks a lot!
Ehm… I am very new to WordPress php, could you please post an example of how to implement that?
I blindly tried to do it this way but it made things much worse ??
add_action( 'save_post', 'trigger_build', 10, 3 ); function trigger_build() { write_log('Start'); $curl = curl_init(); curl_setopt_array($curl, array( CURLOPT_URL => 'https://drone.tametodesign.it/api/repos/matteocarpi/CMB/builds/', CURLOPT_RETURNTRANSFER => true, CURLOPT_ENCODING => '', CURLOPT_MAXREDIRS => 10, CURLOPT_TIMEOUT => 0, CURLOPT_FOLLOWLOCATION => true, CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1, CURLOPT_CUSTOMREQUEST => 'POST', CURLOPT_HTTPHEADER => array( 'Authorization: Bearer <TOKEN>' ), )); curl_exec($curl); curl_close($curl); remove_action('save_post', trigger_build()); }
Thanks!!
- This reply was modified 4 years, 1 month ago by mcarpi.
Viewing 3 replies - 1 through 3 (of 3 total)