How to Create Advanced Search Form In WordPress Website

Why use a WordPress Search Plugin?

If you are creating a new WordPress website or blog, you have to keep your content is easy to find for users. However, if you would add more content to your website, it should be easily found.

We all think that users search with the search engine only, but when you add site search it help your website user find more content that is particularly related to his search.

The site search also helps your website boost customer engagement, reduce bounce rate, and improve higher conversion and revenue.

Further, the good news about adding create advanced search form in WordPress is you will build more traffic to your site that easily promotes your website performance and help you to rank one on Google.

Advanced Search Form In WordPress

Best plugins for Create Advanced Search Form In WordPress

Ivory Search

ivory search

download button

Ivory search is one of the best plugins to create advanced search forms in WordPress. It is simple and easy to use a plugin that allows default WordPress search and enables you to create new custom search forms.

With this plugin, you can create a limited number of search forms that easy to configure and customize.

This will display the custom search form on the site header, footer, navigation menu, pages, post, and anywhere on the site with the help of shortcodes.

The key feature involved in this includes a search of WooCommerce products, images, file attachments, and more.

WP Google Search

WP Google Search

download button

WP Google Search is also a premium Google search feature on your WordPress site. This will only need to register on Google custom search and you will create your Google search engine ID.

Enter into the plugin settings this will allow the custom search engine will be ready to use and you will generate the new Google Search Box with getting on the sidebar.

All settings can be easily done on the Google custom search engine admin site. Once you register to the Google custom search engine, you will get everything you need.

WP Google search is available in multiple languages such as English, Spanish, Serbian, Danish, and Russian.

Search Regex

search regex

download button

Search Regex is yet another best plugin to create advanced search forms in WordPress. It is a powerful set to search and replace the function to WordPress pages, custom post types, and other data sources.

This will work beyond your expectations because it is based on standard searching capabilities that allow you to search and replace any of the data on your site.

This plugin will give full power and simple searches to the users. You can use Search Regex to migrate the user from one domain to another, updating the URL links and images and performing the site-wide changes.

You can search with this any custom post type, plugins, post pages, etc.

SearchWP Live Ajax Search

SearchWP Live Ajax Search

download button

SearchWP enables the user to get powered live search for the search forms. It is also known as the developer’s best friendly search plugin to keep you away from the way, but at the same time, it will allow and get customize features to everything.

This will enable you to set up and work with any WordPress theme. You can load the display results quickly. SearchWP plugin will implement a great range of content on your website without creating cluttered options.

You can customize and implement this plugin to give a greater degree of freedom to users. It is also a developer-friendly and developer defines plugin that comes up with complete documentation.

Ajax Search for WooCommerce

Ajax Search for WooCommerce

download button

Ajax search is the most popular plugin to create advanced search forms in WordPress. This will allow the users to get a best-advanced search bar with the live search suggestions, which is the most beneficial search solution for every eCommerce site.

In 2022, customers expect the search should be more defined. Further, it is now offered 96% of major eCommerce as it has must great features such as search the product by title, short description, product image, product description, special mobile features, and details.

With this, you will also get the live displayed suggestions, better ordering, Google Analytics support, WPML compatible, and PolyLang compatible features.

WOOF

woof

download button

WOOF is also the best plugin to create advanced search forms in WordPress site. It is a special plugin designed for WooCommerece that allow you site customize searched with products tags.

Product SKU, and price. If you are using latest version of WooCommerce then WOOF is must have plugin for your website.

Relevanssi- A better search

relevanssi

download button

If you are looking for the best plugin to create an advanced search form in WordPress, read this. It allows a better search engine and a lot of configurable plus features.

Right now, it available on the free version and you will also get more options with the premium version.
In this plugin, you will get the search related to the order of relevance such as Fuzzy matching words, phrases, and search with quotes.

WP Extended Search

WP Extended Search

download button

With the WP Extended Search plugin, you can create an advanced search form in WordPress that allows customizing WordPress search in your blog post.

You can search the post with their Meta title, author names, categories, custom taxonomies, and others. It can also control the default behavior of the search engine via post, title, pause content, and posts script.

This plugin will allow the features as you can search meta, categories, tags, include or exclude public post type, customize the number of posts, customize SQL, customize the order of search results, control match search query, and many more.

Better Search

better search

download button

Better search is one of the famous plugins to create an advanced search form in WordPress that load results super fast in your search engine. It gives results to the relevant query quickly.

This means when the visitor visits your blog, they will quickly find what you are looking for. This plugin is packed with various options and features.

You can easily customize the search plugin; you can also assign the weightage title or content to be shown on search.

Furthermore, they will also give the advanced search and are packed with various filters and actions that allow you to easily extend the plugins features.

Additionally, these searches display on the search heat map that usually other plugins do not. Better search is automatic, customize, seamless integration and relevance, and popular search plugin you can choose.

Search Exclude

Search Exclude

download button

Search Exclude is also the best search plugin you can use to create an advanced search form in WordPress.
With this plugin, you can exclude any page post or whatever from the WordPress from search results by checking out the checkbox on post and edit pages.

This will supports you with quick and bulk edits. Also, this plugin will allow the setting pages, so you can list the items you want to exclude or include from the search.

How To Create Advanced Search Form In WordPress For Custom Post Types Using Code?

WordPress built-in search option is quite ineffective and hence, the only option people opted for is Google Custom Search.

But there are many owners who do not like to use Google Custom Search especially when they have custom post types like reviews, videos, image-related photos along with general informative posts.

It is a fact that Google Custom Search option is not an impressive option and many feel like it reduces the user experience significantly.

It is always handy to create advanced search form in WordPress for custom post types where the visitors of the website can select the types of posts where they want to do the search.

For examples, all the post types like videos, reviews, and others will be provided in checkbox style, and users will be able to select the post types where they want to search for something.

As a matter of fact, they can select multiple types of posts to search from and get all the relevant search results. In this article, we will illustrate how to create advanced search form in WordPress for custom post types.

advance search

Most of the themes on WordPress come with two very important files as far as searching goes. One of them is searchform.php.

The location of the form might vary from theme to theme, and hence, you have to connect to your FTP and search for it if it is not available under Editor option from your Admin Dashboard’s Appearance option. Sometimes, the file name may also vary and hence, you may contact your theme’s support team to know its name.

Once you find the file, edit it and add the following piece of code into it.

$query_types = get_query_var('post_type');   
<label>Articles</label>
<label>Blog</label>
<label>Books</label>
<label>Videos</label>  

Then you need to edit the value with the name of your custom post types as they exist of your website. If you have more custom post types, you can add similar lines and replace the values accordingly.

It is important to note that you should not add Pages custom post type here. This code is added to create an array so that it could be called in the next file and all the checkboxes can appear checked when the user sees the box for the first time. So, by, default, the searching will be done on all the post types.

light

Now you need to open the second most important search file named search.php. You are likely to get to from going to Admin’ Dashboard, Appearance and then to Editor.

Locate the file from the right side under the label Search Results. Add the following piece of code in that and update the file.


form role=&quot;search&quot; method=&quot;get&quot; id=&quot;searchform&quot; action=&quot;"&gt;
input type=&quot;text&quot; name=&quot;s&quot; id=&quot;s&quot; value="" value="Enter keywords &hellip;" onfocus="if(this.value==this.defaultValue)this.value='';" onblur="if(this.value=='')this.value=this.defaultValue;"
 
<label>Articles</label>
input type=checkbox name=post_type[] value=post <label>Blog</label>
input type=checkbox name=post_type[] value=books <label>Books</label>
input type=checkbox name=post_type[] value=videos; <label>Videos</label>  

Once again, the value of the input boxes must be same as the custom post types you have on your website and should also be similar to what you have in your searchform.php file.

This will show the checkboxes to the users in already marked state and search accordingly. Many would prefer a dropdown but it is always better to go with checkboxes because users will be able to select more than one option.

How To Create Advanced Search Form In WordPress For Custom Post Types Using Plugins?

It is safe to say that some people would not be able to do the above task of coding correctly because they have to search for searchform.php and hence, there are high chances of messing things up.

It is wise to go for a tailor-made search form plugin which is designed for custom post types. Search & Filter Pro is the plugin you need to go for, and it offers you to have fields like custom post types, taxonomies, categories, authors, post dates and much more. For any review site, it is a must.

If you have an e-commerce site using WooCommerce, you can provide your visitors great user experience with it.

search and filter pro

The price of the plugin is merely $20 and if you are a developer, you can go to developer license for $75 and create amazing parameters.

You have to pay the price and get the plugin downloaded and then install on your WordPress site. To install it, you have to go to Dashboard and then to Plugins on the left menu where you have to click on Add New option from the dropdown.

In the next screen, you will find the button Add New at the top. Select the zip file you have downloaded and let it get uploaded and then Activate it. You will get one year of support and upgrades for free.

Picture1

The plugin works with multilingual support(WPML), WooCommerce, and Advanced Custom Fields plugins where you can attach dropdown, checkboxes, and various other fields.

Various other frontend UI elements can be used like date picker and range sliders. There are also options for sorting the result by various parameters like the ones you get with advanced Google search.

If you are going to create advanced search form in WordPress for custom post types using codes, make sure you take a full backup of your website.

If you find that your search toolbar is getting used widely by the visitors of your site, you should definitely go for the Pro plugin and offer different parameters that you cannot create with the code that we provided above.

The more functionalities you provide, the better would be the user experience, and your website will be the go-to website in your niche for that feature only.

About Sonl Sinha

Sonl SinhaSonl Sinha is a passionate writer as well as WordPress and WooCommerce rockstar who loves to share insights on various topics through his engaging blog posts. He runs a successful website design and digital marketing company. With 15+ years of experience in WordPress theme development, he strives to inform and inspire readers with his thought-provoking content. He helps thousands of small and medium businesses and startups create a unique online presence. Follow Sonl Sinha for your regular dose of knowledge and inspiration.

Do check out our free WP themes and WordPress themes bundle