Skip to content

Instantly share code, notes, and snippets.

@lewayotte
Created March 14, 2016 04:57
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save lewayotte/bf8327455498bf2e07d6 to your computer and use it in GitHub Desktop.
Save lewayotte/bf8327455498bf2e07d6 to your computer and use it in GitHub Desktop.
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' );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment