I’ve created a site search with automatic top 10 results, in a dropdown plus a button to view all results, as the user types. I use the REST API search results endpoint to grab the search results.
The site will be 90% posts with all content inside post_content
but there will be a number of pages that I want these to be searchable but I envisage the content being too complicated for ACF Blocks so I expect there will be standard ACF meta boxes so a lot of the data for the pages will be in postmeta.
Can postmeta be included using the rest_post_search_query
hook that will mean both posts and pages (with ACF fields) are returned in via the API bearing in mind posts won’t have these meta fields.
Would consider other approaches or even a plugin that modifies the WP search to include ACF fields but not sure that would fix it for the API search endpoint too.
Any ideas would be greatly appreciated, thanks
ACF: Better Search
plugin provides a solution for this.