문제

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?

도움이 되었습니까?

해결책

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.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 wordpress.stackexchange
scroll top