SAAS REST API for WordPress
<?php
function wcatl_api() {
if ( !empty( $_GET['wcatl'] ) ) {
try {
$input = file_get_contents( 'php://input' );
$post = json_decode( $input, TRUE );
if ( !empty( $post['post-id'] ) ) {
error_log( sprintf( 'New Post Published %s', $post['post-id'] ) );
}
}
catch ( Exception $e ) {
error_log( $e->getMessage() );
}
exit;
}
}
add_action( 'init', 'wcatl_api' );