Skip to content

Instantly share code, notes, and snippets.

@martijn94
Last active January 26, 2016 22:55
Show Gist options
  • Save martijn94/b0ef65436892d279dccd to your computer and use it in GitHub Desktop.
Save martijn94/b0ef65436892d279dccd to your computer and use it in GitHub Desktop.
Register WP REST API route
<?php
add_action( 'rest_api_init', 'wpc_register_wp_api_endpoints' );
function wpc_register_wp_api_endpoints() {
register_rest_route( 'somename', '/search', array(
'methods' => 'GET',
'callback' => 'wpc_somename_search_callback',
));
}
function wpc_somename_search_callback( $request_data ) {
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment