Search exclusions and/or “OR” operators in search

  • I make use of the Search features in several WordPress sites, using the following syntax:

    https://website.com/?s=searchterm1+searchterm2+searchterm3

    However there are some cases where I need more advanced search. What I would ideally like to figure out is if one or both of the following cases are possible via this URL syntax:

    1. A long exclusionary list.
      What I mean is that I can filter out terms with the negative sign (s=-searchterm1+-searchterm2+-searchterm3) but for some reason this begins to fail after 5 or so terms are included. Is there some sort of upper limit for adding terms in this way?
    2. An “OR” operator
      Stringing together search terms provides results that show an implicit “and” operator. My search above will show only items that include all 3 search terms together. Is there a way search for items with term1 OR term2 OR term3, etc?

  • Hi! Welcome to the support forums for sites hosted on WordPress.com. Are you asking about the search function specifically with regards to sites that are hosted with us? The reason I ask is that we’re not really able to provide accurate help for self-hosted WordPress sites – for that you may find you’d be able to get more answers from the WordPress.org forums:
    https://wordpress.org/support/forums/

  • This seems to be default behavior for WordPress whether self-hosted or on the .com domain. So let me rephrase the basic URL in question to:

    https://website.wordpress.com/?s=searchterm1+searchterm2+searchterm3
  • Hi there,

    The built-in search function on WordPress sites (wether “self-hosted” with another provider, or a WordPress.com site on our managed hosting) so there is a limit to how much customization can be applied. Specifically there is not a way to use Boolean operators (And, Or, Not, etc) in the default search option, either via URL hacking or otherwise.

    With that in mind you may wish to try out our enhanced Jetpack Search option, which is a powerful replacement for the search capability built into WordPress. It provides higher quality results and an improved search experience that is similar to contextual searches you find on Google and other search engines. You can learn more here:

    WP
    Jetpack Search
    1 min read
    Jetpack Search is a powerful replacement for the search capability built into WordPress. It provides higher quality results and an improved search experience. This feature is available on any WordPress.com site by purchasing the Add-On from Jetpack.com. Requirements Jetpack Search can be used as long as your site has a search function. You can have a search function on any WordPress

    Also it is possible to add plugins to your WordPress site (similar to how you add apps to your phone to extend it’s functionality) and you can see what is available to add to your site here: https://wordpress.com/plugins/?s=search

    Please note that to add plugins to your site you will need an upgrade, as it is not possbile to add plugins to our free sites.

    Hope that helps. Please let us know if you have any more questions.

  • The topic ‘Search exclusions and/or “OR” operators in search’ is closed to new replies.