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

How to create post with a date, AKA scheduled post #494

Open ygweric opened 2 years ago

ygweric commented 2 years ago

Can I do something like following code ?

wp.posts().create({
    title: 'Your Post Title',
    content: 'Your post content',
    date: new Date("2022-09-01")
    status: 'scheduled'
}).then(function( response ) {
    // "response" will hold all properties of your newly-created post,
    // including the unique `id` the post was assigned on creation
    console.log( response.id );
})
BasToTheMax commented 2 years ago

I don't know, but you can always try :) (I will test your code and see what happens)