Include results with tags relevant to the search keyword with JSON rest API v2

Wordpress doesn't natively search for tags so I need to install WP Extended Search and add post_tags as one of its parameters so whenever I search for keywords natively, posts with that tag will appear.

However, when I tried searching on the wp-json REST API, that post doesn't appear. Here's an example with a post that is tagged with technology.

When I search technology using this json rest api url, it returns an empty array:

example.com/posts?search=technology

But if I search natively using this url, the posts tagged with technology appears

example.com/wp-json/wp/posts?search=technology

The only way the posts will appear is when I put technology somewhere in the title or in the content but I don't want to put it in the content. How will my posts with tags appear in the results on the REST API when I search for that keyword?

Topic rest-api json tags Wordpress search

Category Web


WP Extended Search does not work with REST by default since version 2.0.2 This is to achieve maximum compatibility with WordPress and other plugin/themes.

To enable the support, pass wpessid in REST request with ID (for specific search setting) or without ID (for global search setting). e.g. /wp-json/wp/v2/posts?search=technology&wpessid or /wp-json/wp/v2/posts?search=technology&wpessid=10

Ref: https://wordpress.org/support/topic/search-queries-with-metakey-name-issue-version-2-0-2/#post-14376988

PS:- I am the author of this plugin. To keep things organized I suggest do not post plugin/theme support questions here. Use relevant support forum to ask plugin/theme related question.

About

Geeks Mental is a community that publishes articles and tutorials about Web, Android, Data Science, new techniques and Linux security.