-
-
Save jimboobrien/979abeb745b0c7d9306c94d48ec34cd5 to your computer and use it in GitHub Desktop.
SAAS REST API for WordPress
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
<?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' ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment