Question

I'm using WP REST API plugin for a custom web application and I need to get access to the scheduled posts of the target wordpress website. However I can't find any parameter or filter to achieve this on the documentation.

Have tried passing the future date of a post in the API request query string but nothing returns.

Tried to get a future (scheduled) post by passing directly his id with /wp-json/posts/57117 and I get an error response.

[{"code":"json_user_cannot_read","message":"Sorry, you cannot read this post."}]

How is the right way to access the data for scheduled posts? They are not password protected, just scheduled. This needs authentication somehow?

Was it helpful?

Solution

I found the answer, dropping it here in case someone need it.

You need to be logged in as a user that has the edit_posts capability. With that capability, you also get access to the private query vars, including post_status.

Taken from this similar issue.

Licensed under: CC-BY-SA with attribution
Not affiliated with wordpress.stackexchange
scroll top