jwatkins/rest-api-search

A Composer wrapper for the "REST API Search" WordPress plugin

Installs: 15

Dependents: 0

Suggesters: 0

Security: 0

Stars: 0

Watchers: 2

Forks: 3

Type:wordpress-plugin

v1.0 2017-12-01 18:12 UTC

This package is auto-updated.

Last update: 2024-04-11 13:47:38 UTC


README

This is only for Version 2 of the REST API Plugin

This adds the missing functionality of Search into the WordPress REST API. The issue being with the current REST API Version 2, you can only search on a per post_type basis.

/wp-json/wp/v2/posts?filter[s]=apples

/wp-json/wp/v2/pages?filter[s]=apples

What this plugin does.

Adds the search functionality for all posts types except revisions and types with 'exclude_from_search' set to true.

/wp-json/wp/v2/search/apples

In case of a multi word string, just replaces the spaces with plus signs.

/wp-json/wp/v2/search/apples+pears

Also adds easy paging

page 2:

/wp-json/wp/v2/search/apples+pears/2

page 3:

/wp-json/wp/v2/search/apples+pears/3