WP API : date_query parameter

I’m using WordPress API just to perform some tests. I’m currently working with the date_query parameter, which, in my case, doesn’t work as expected.

Just consider this request : https://wptest.enguerranweiss.com/wp-json/wp/v2/posts?filter[orderBy]=date&filter[order]=DESC&filter[date_query][after]=2016-10-13T17 (dummy install, dummy content)

What I expect : the API should only return the posts more recent than 2016-10-13. Right now, the filter seems to be ignored.

Any idea?

1 Answer
1

As of WP >= 4.7 filter[] is not supported and have been removed. Also WP REST API Plugin became part of WordPress Core.

According docs your link should be:

https://wptest.enguerranweiss.com/wp-json/wp/v2/posts?orderby=date&order=desc&after=2016-10-13T17:00:00

EDIT

As enguerranws mentioned the date should be in ISO8601 format

Leave a Comment