Skip to content

Instantly share code, notes, and snippets.

@justingreerbbi
Created October 2, 2015 00:51
Show Gist options
  • Save justingreerbbi/22c3596275e1536b51be to your computer and use it in GitHub Desktop.
Save justingreerbbi/22c3596275e1536b51be to your computer and use it in GitHub Desktop.
Extend Resource API endpoints
add_filter('wo_endpoints','new_hello_endpoint', 2);
function new_hello_endpoint ($methods){
$methods['hello'] = array(
'func'=>'run_hello_method' // Function name to run
'public' => true|false // True to be public
);
return $methods;
}
function run_hello_method ($token){
$return = array('say'=>'hello');
$response = new OAuth2\Response($return);
$response->send();
exit;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment