WordPress.org

Make WordPress Core

Opened 8 months ago

Closed 2 days ago

#49647 closed enhancement (maybelater)

Extend REST API search endpoint with "after" and "before" which the posts endpoint already supports

Reported by: archon810 Owned by:
Milestone: Priority: normal
Severity: normal Version: 5.0
Component: REST API Keywords:
Focuses: Cc:

Description

Hi,

I'd like to use the search API but provide the after parameter. I was surprised to see there's no parity to posts and it's not supported.

https://developer.wordpress.org/rest-api/reference/posts/

https://developer.wordpress.org/rest-api/reference/search-results/

Is there a reason most, if not all, params supported by posts aren't present in search? Can they be?

Thanks.

Change History (2)

#1 @SergeyBiryukov
8 months ago

  • Component changed from General to REST API

#2 @TimothyBlynJacobs
2 days ago

  • Milestone Awaiting Review deleted
  • Resolution set to maybelater
  • Status changed from new to closed
  • Version changed from 5.3.2 to 5.0

Hi @archon810,

The purpose of the Search endpoint is to provide a unified, minimal interface for performing basic searches across a variety of different WordPress entities; it has been recently extended to support terms and post formats.

Searching by date isn't something that can be universally implemented.

I would instead recommend using the existing posts endpoint for performing those searches, or implementing a custom endpoint.

Note: See TracTickets for help on using tickets.