Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- add_action('publish_post', function( $ID, $post ) {
- if ($post->post_type == 'post') {
- $webhook_url = 'https://example.com/webhook-endpoint';
- $response = wp_remote_post(
- $webhook_url,
- array(
- 'method' => 'POST',
- 'body' => json_encode( $post ),
- 'headers' => array('Content-Type' => 'application/json')
- )
- );
- }
- }, 10, 2);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement