2

I want to check if a post already exists. This includes to check if the post exists as draft as well. But I struggle a little bit with the wordpress API v2. http://v2.wp-api.org/reference/posts/
Under List Posts -> status they say

Limit result set to posts assigned a specific status.
Default: publish

I tried to assign the value as parameter, but I get an error response:

{"code":"rest_invalid_param","message":"Invalid parameter: status","data":{"status":400,"params":{"status":"Status is forbidden"}}}

I als asign the title of the post to check:

filter[s] = post Title

So how to get the posts with draft state? I'm currently using the Basic Auth for developing?

I also tried

filter[post_status]=draft

but with no success.

I have the following plugins installed: WP REST API
WP REST API - filter fields
JSON Basic Authentication

1

I think the query parameter that you want for post status is:

status=draft

Let me know if this doesn't work.

  • Yes that worked, thanks. I tried it with this at the beginning but it didn't work, so I'm confused that it works now. – Ronon Dec 1 '16 at 20:19

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.