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

Changing post_type #482

Open dundunn opened 3 years ago

dundunn commented 3 years ago

I would like to create a post with wp.posts().create() and assign it the correct post_type, however this does not seem to work with the post_type key. Either using create() or update() doesn't change that value.

That code leads to a post that has the post_type of post and not wprm_recipe. How could I change that value?

    const firstPost = await wp.posts().create({
        title: title,
        content: summary,
        status: 'draft',
        comment_status: 'closed',
        ping_status: 'closed',
        slug: slug,
        post_type: 'wprm_recipe'
    });