1

I am writing a program to switch a post between publish and schedule

For a scheduled post, I try to set post_status from future to publish, and set a past time to post_date and post_date_gmt, but the post still not be published

For a published post, I try to set post_status from publish to future, and set a future time to post_date and post_date_gmt, this time the post will disappear from the website, but after the future time I set, the post still not be published.

How to switch post status in MySQL?

  • 1
    Does it really have to be done in MySQL via raw SQL queries? A call to the REST API would do just as fine, and even trigger all the relevant hooks actions and queries for plugin compatibility – Tom J Nowell Jan 23 '18 at 14:27
  • 1
    Also keep in mind that you'll be bypassing the caching layers, invalidating object and page caches, meaning you could encounter other issues – Tom J Nowell Jan 23 '18 at 14:28

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.