How can I create new CustomPostType record using wp.api.collections?

I would be very grateful for your help. Already racked my brain for today!

So, I used the CPT UI plugin and created my custom post type with it. Immediately when setting it up, I enabled RestAPI support (I always do this), and I also used the default WP_REST_Posts_Controller setting.

When I give the command to add the default Post

var review = new wp.api.models.Post( { title: 'Test post' } );
review.save();

everything is fine!

But when I try to specify my registered Review type instead of Post, I get an error Uncaught (in promise) TypeError: wp.api.models.Review is not a constructor

How can I solve this problem? Thank you in advance!

Topic wp-api rest-api custom-post-types Wordpress

Category Web

About

Geeks Mental is a community that publishes articles and tutorials about Web, Android, Data Science, new techniques and Linux security.