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

How to create post with a date, AKA scheduled post

Open ygweric opened this issue 3 years ago • 1 comments

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

ygweric avatar Dec 09 '21 01:12 ygweric

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

BasToTheMax avatar Dec 21 '21 16:12 BasToTheMax