Created
September 5, 2018 11:50
-
-
Save daliborgogic/f9bfc7500268987113d58ff626fa7782 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function notify_post ($post_id) { | |
$request = new WP_REST_Request('GET', '/wp/v2/posts/' . $post_id); | |
$response = rest_do_request($request); | |
$status = $response->get_status(); | |
$data = $response->get_data(); | |
$callback_uri = 'https://example.com'; | |
wp_safe_remote_post($callback_uri, array('body' => json_encode($data))); | |
} | |
add_action('post_updated', 'notify_post'); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment