WP-API / node-wpapi

An isomorphic JavaScript client for the WordPress REST API
http://wp-api.org/node-wpapi/
MIT License
1.68k stars 191 forks source link

I have a custom post type "coupon" can I use wpapi to create a new coupon entry? #490

Open Goussaka opened 3 years ago

Goussaka commented 3 years ago

I have a custom post type "coupon" can I use wpapi to create a new coupon entry? i use this code await wp.types().type('coupon').get({}) i get the result below

================ DONE ==================== { description: '', hierarchical: false, name: 'Coupons', slug: 'coupon', taxonomies: [ 'coupon-category', 'coupon-store' ], rest_base: 'coupon',

.....

northwest-dev commented 2 years ago

Try this: wp.coupon().create({title: 'My Coupon', status: 'publish'}).then(data => {/* do something with response */});