Recently, I was trying to update the post status of a post from future
to publish
with the WordPress REST API and while the submission appeared to work, the value was not modified.
Of course, the first thing I checked was to make sure I was setting the X-WP-Nonce
since I was trying to update a value (see Test WordPress REST API Endpoints from the Browser with jQuery for more information).
Finally, I realized that WordPress wouldn’t let me set the post status to publish
because the post_date had not yet passed. In other words, the post was scheduled for the future so when I tried to change the status to publish
, WordPress prevented this change.
I’d love to see the API response modified to return an error message when it fails like this. If anyone is looking to make an open source contribution to WordPress, I’d love this.
Leave a Reply