node-wpapi icon indicating copy to clipboard operation
node-wpapi copied to clipboard

Changing post_type

Open dundunn opened this issue 4 years ago • 0 comments

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'
    });

dundunn avatar Mar 02 '21 16:03 dundunn