最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

custom post types - How can I create new CustomPostType record using wp.api.collections?

programmeradmin1浏览0评论

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!

发布评论

评论列表(0)

  1. 暂无评论