• Anonymous User 18649444

    (@anonymized-18649444)


    I need some help on using the WordPress Search API /wp-json/wp/v2/search

    how to pass two parameters to search so they work as OR. When I pass the following query it is working as AND.
    /wp-json/wp/v2/search?search=Jupiter&search=Saturn

Viewing 1 replies (of 1 total)
  • Joy

    (@joyously)

    If you read the code of parse_search, you’ll see that OR is only used for exclusion.
    https://developer.ww.wp.xz.cn/reference/classes/wp_query/parse_search/
    As a human typing more words, it makes more sense to use AND, as a way to narrow down the results. Using OR would make so many more results that the search wouldn’t be useful. But with the API, you could submit the two separately, and that would be OR…

Viewing 1 replies (of 1 total)

The topic ‘Passing multiple keywords to Search API’ is closed to new replies.