Skip to content

Instantly share code, notes, and snippets.

@modemlooper
Created October 7, 2015 14:34
Show Gist options
  • Save modemlooper/844e4b5e22a7b4034dbe to your computer and use it in GitHub Desktop.
Save modemlooper/844e4b5e22a7b4034dbe to your computer and use it in GitHub Desktop.
add custom post type to WP-API
function wpsd_add_events_args() {
global $wp_post_types;
$wp_post_types['incsub_wiki']->show_in_rest = true;
$wp_post_types['incsub_wiki']->rest_base = 'wiki';
$wp_post_types['incsub_wiki']->rest_controller_class = 'WP_REST_Posts_Controller';
}
add_action( 'init', 'wpsd_add_events_args', 30 );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment