Croco Black Friday 2024 banner element
Copy discount code:
bfcroco2024
Days
Hours
Minutes
Croco Black Friday 2024 banner element
Help Center
How to Exclude Certain Terms and Posts in AJAX Search Query

How to Exclude Certain Terms and Posts in AJAX Search Query

This tutorial provides a detailed guide about setting search excluding certain terms and posts using the JetSearch AJAX Search widget.

Before you start, check the tutorial requirements:

  • Elementor (Free version) or Block editor (Gutenberg);

  • JetSearch plugin installed and activated.

Excluding Certain Terms and Posts in a Search Query in Elementor

Open the page where you added the AJAX search widget with the Elementor editor.

page with ajax search

Adjust the widget settings.

Firstly, proceed to the Content tab and unfold the Search Query section.

ajax search query

Now you need to specify the source (the search areas) over which the search will be done.

To add a source, simply click on the Plus button and select the needed one from the drop-down list. You can select as many source areas as you want.

add a source to the search query

Below you will see two options: Include and Exclude. Click on the Exclude one and determine the certain terms and whether you need specific posts.

In our example, we have posts with different categories and tags. We want to exclude the posts in the Interview and Awards categories from the search.

bookstore posts

Under the Terms, start typing the needed categories or tags.

added terms

To exclude a specific post from the search, just start entering its title under the Posts.

exclude a specific post

After that, save the settings and check the search on the front end.

The needed posts were successfully excluded from the search results.

search results on the front end

Excluding the Posts from the Search Results in Gutenberg

JetSearch works not only with the Elementor page builder. This plugin allows applying a Search block using Gutenberg as well.

Open the page in the default WordPress editor. Click on the “Add block” button and find the AJAX Search block.

ajax search block

Proceed to the Block tab and firstly unfold the Search Query section. Here you need the set the search area.

search query area

Scroll down and unfold the next section called Search Query Includes/Excludes.

search query settings

The process is similar to the one described in the first part of this tutorial for the Elementor editor.

Simply add the terms under Exclude and select a specific post if needed.

added terms to the exclude

Don’t forget to click the “Update” button and preview the search block on the front end.

Now you know how to exclude some terms and posts in a search query with the AJAX Search widget.

Was this article helpful?
YesNo

Need help?

Ask Facebook community

Get answers from 22K Crocoblock Community experts from all over the world.

Start a live chat

Ask question to support agent and share its details via chat messages.