0

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?

2
  • is this not a bug with WP Extended Search? What you're describing is how WordPress normally works, if the plugin changes that but they forgot to do it for the REST API then you need to raise a bug report with them
    – Tom J Nowell
    May 25, 2022 at 10:15
  • @TomJNowell - I have already sent a support forum on the plugin page. For now, I have tried different plugin and got it working with the plugin called search everything wordpress.org/plugins/search-everything May 26, 2022 at 10:48

1 Answer 1

1

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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.