Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
Goussaka opened this issue Sep 2, 2021 · 1 comment

Comments

@Goussaka
Copy link

Goussaka commented Sep 2, 2021

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
Copy link

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants