Better Search + WP REST API
-
Hi!
So far, Better Search has been great, results are fast and posts returned are much more relavant. I’m running into an issue with AJAX however.
After loading the first 10 posts on the search page, the user can load the next 10 posts by clicking a “Load More” button which hits queries a URL similar to: “https://urlhere.com/wp-json/wp/v2/posts?page=2&per_page=10&search=videos”. Instead of the next 10 posts, however, this endpoint returns an empty array.
After quite a bit of testing, I realized the “search” argument breaks the endpoint. During more tests, I noticed the route “/wp-json/wp/v2/search” works, but again, if you enter a search argument e.g. “../v2/search/?search=videos”, it breaks. Oddly enough, “../v2/search/?search=” works.
Disabling the Better Search plugin returns all endpoint functionality to normal.
Help please?
- You must be logged in to reply to this topic.