Created
March 14, 2016 04:57
-
-
Save lewayotte/bf8327455498bf2e07d6 to your computer and use it in GitHub Desktop.
SAAS REST API for WordPress
This file contains 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