Skip to content

Instantly share code, notes, and snippets.

@misfist
Created September 22, 2015 16:21
Show Gist options
  • Save misfist/9a9b5eb566313ad93181 to your computer and use it in GitHub Desktop.
Save misfist/9a9b5eb566313ad93181 to your computer and use it in GitHub Desktop.
Add custom post type to Rest API
register_post_type('service',
array(
'labels' => array(
'name' => __('Services'),
'singular_name' => __('service')
),
'public' => true,
'has_archive' => true,
'show_in_rest' => true, //Adds the custom post type to the rest api
)
);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment