Skip to content

Date Query Reference

Brian Daley edited this page Dec 20, 2024 · 2 revisions

Date Queries

To query for posts by a date or date range using the WordPress REST API, you can use the date_query parameter in your URL. Here are some examples:

  1. Query for posts on a specific date:
/wp-json/wp/v2/experience?date_query[after]=2023-01-01T00:00:00&date_query[before]=2023-01-01T23:59:59
  1. Query for posts after a specific date:
/wp-json/wp/v2/experience?date_query[after]=2023-01-01T00:00:00
  1. Query for posts before a specific date:
/wp-json/wp/v2/experience?date_query[before]=2023-01-01T23:59:59
  1. Query for posts within a date range:
/wp-json/wp/v2/experience?date_query[after]=2023-01-01T00:00:00&date_query[before]=2023-01-31T23:59:59

Clone this wiki locally