Moussa
Moussa

Reputation: 4154

Wordpress JSON API get posts from a given date

I am using the plugin wordpress' RESTful API plugin called JSON API and I would like to get posts from a given date. I tried many parameters but it didn't work for me, can you help me please?

Here is what I have tested for instance :

http://www.example.com/?json=get_date_posts&date=20140806&posts_per_page=-1

or

http://www.example.com/?json=get_posts&after=20140806&posts_per_page=-1

Upvotes: 2

Views: 3783

Answers (3)

mapetek
mapetek

Reputation: 141

You can get all posts from a date using get_posts with params below

count = -1

date_query[0][after] = 20160101

http://www.example.com/api/get_posts/?count=-1&date_query%5B0%5D%5Bafter%5D=20160101

You can see all date params on https://codex.wordpress.org/Class_Reference/WP_Query#Date_Parameters

Upvotes: 0

nima72
nima72

Reputation: 36

don't if it still helps but you should use something like this: json=get_date_posts&date=after%2020150318

Upvotes: 0

Llewellyn Collins
Llewellyn Collins

Reputation: 2341

This WP plugin has documentation JSON API Docs.

Please see this part Method:get_posts this call accepts the same parameters as WordPress's WP_Query parameters, which can be found here WP_Query parameters.

The part you are looking for is Date parameters.

Example: http://www.example.com/?json=get_date_posts&year=2012&monthnum=12&day=12&posts_per_page=-1

Upvotes: 1

Related Questions