-
-
Save bitflower/c270fb9c762b509a0f79 to your computer and use it in GitHub Desktop.
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
class MAP_API_DemoItemType extends WP_JSON_CustomPostType { | |
protected $base = '/map/demo'; | |
protected $type = 'demo'; | |
public function register_routes( $routes ) { | |
$routes = parent::register_routes( $routes ); | |
return $routes; | |
} | |
} | |
function map_api_init( $server ) { | |
global $map_api_demoitemtype; | |
$map_api_demoitemtype = new MAP_API_DemoItemType( $server ); | |
add_filter( 'json_endpoints', array( $map_api_demoitemtype, 'register_routes' ) ); | |
} | |
add_action( 'wp_json_server_before_serve', 'map_api_init' ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment