In my wordpress, I have public posts,draft posts and private posts. I installed WP REST API, so that I can access posts from another domain.
I am able to retrieve the public posts easily with following json command
http://www.example.dev/wp-json/posts?_jsonp=?
complete code
http://codepen.io/anon/pen/YXNrre
But, I could not retrieve private posts and draft posts. I think, I need to pass login information
I also tried
http://www.example.dev/wp-json/posts?type[]=post&_jsonp=?
http://www.example.dev/wp-json/posts?type[]=post&filter[status]=private&_jsonp=?
http://www.example.dev/wp-json/posts?filter[status]=private
How to pass authentication information to server from client side? I have wordpress login and pass word. I don't know php. I think I only need jquery. and how to access private posts from another domain using JSON? thanks in advance.
There is API documentation here. http://wp-api.org/#posts_retrieve-posts
The field that sets the status for posts is called "post_status", not just "status". The default for post_status is generally "publish".
Also, you can only use that field if you are authenticated like you mentioned. There's docs for that here http://wp-api.org/guides/authentication.html
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With