Reputation: 9664
Using the Wordpress REST API I am trying to get draft posts only. However the API responds with only the published posts when I pass the query in both cases.
A: http://localhost/wp-json/wp/v2/posts?status=draft
B: http://localhost/wp-json/wp/v2/posts?filter[post_status]=draft
How can I see only the draft posts? I am using the JWT Authentication for WP-API plugin for authentication but disabling this doesn't seem to change anything.
Upvotes: 3
Views: 5797
Reputation: 1
for getting draft posts you should send an Authorization token, so you can use JWT Authentication for WP-API plugin for getting it and use it anywhere, and for getting posts with drafts status you should send 'status': 'draft' as a param in your request, also if you want to get all of status you should send 'status': 'any' in your params in request. :)
Upvotes: 0
Reputation: 2910
This is because just installing the JWT Auth plugin doesn't solve the problem. There are also some modifications to be performed on the .htaccess
file as well as in wp-config.php
.
I hit a similar problem but with private posts, so I created a video detailing the steps you need to follow to install and configure the JWT Authentication plugin.
Upvotes: 0