Back to contents

JetSearch. How to set a field key to search in custom fields

In this tutorial, you will find detailed information about the process of setting a field key for seeking in custom fields using JetSearch functionality.

With JetSearch Ajax Search widget you can customize the search results by setting search in certain meta fields. It allows searching only in particular custom fields easily.

We are going to present an example based on a travel website, where we want to add a search by a certain custom field in tours.

Setting search in custom fields

1 Step — Adding custom fields in the custom post type

First of all, we created the Tour custom post type and added necessary custom fields, one of them is the Destination. Then, we added different tours and filled the custom fields for each of them. After that, we created a listing and displayed it on the Listing Tours page using JetEngine Listing Grid widget.

Setting search in custom fields

1 Step — Customizing the page in Elementor  

Now we open the Listing Tours page in Elementor and drop the Ajax Search widget in a certain place.

Ajax Search widget

1 Step — Setting a field key in the widget

Then, in the widget’s settings block, we uncover the Content > Search Query tab and specify the Source: Tour and fill the Search in custom fields field with the _destination meta field, in which the search will be filled in.

Search Query tab in Ajax Search

1 Step — Viewing the result

We save the settings and view how the search works.

Ajax Search widget overview

A good job! Try setting search by field key in custom fields using JetSearch plugin.