Created
October 2, 2015 00:51
-
-
Save justingreerbbi/22c3596275e1536b51be to your computer and use it in GitHub Desktop.
Extend Resource API endpoints
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
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