What do i want to acheive?
- i want to create a post for my custom post type with the wordpress rest api
What Api route is having problems?
- http://localhost/proftaak/wp-json/wp/v2/mycustomposttype
What http method are you using?
- POST method (post = not working, get = working)
What Local apache server are you using?
- I'm using xampp as local apache + mysql server.
What have i done?
- I created a new custom post type. see here:
add_action('init', 'create_custom_post_types');
add_action('admin_menu', 'remove_default_post_types');
function create_custom_post_types()
{
// Apparaten (requests)
register_post_type('apparaten', [
'public' => true,
'show_in_rest' => true,
'label' => 'Apparaten',
'menu_icon' => 'dashicons-smartphone',
'capabilities' => array(
'create_posts' => false
),
'labels' => [
'singular_name' => 'Apparaat'
],
]);
}
function remove_default_post_types()
{
remove_menu_page( 'edit.php' );
remove_menu_page( 'edit-comments.php' );
}
i've set my custom post type to show_in_rest to true because i want to use it.
But if i do a post in postman to the url i get this:

i've researched a lot but can't find a solution.
any one an idea?