How to Create a Custom WordPress Search Form
This tutorial shares How to create a custom search form for your WordPress website.
A search form is usually a search icon or single-line text box to receive user input to be searched for in a database.
Adding a search form lets users search content on your site. Therefore, this write-up will help you improve your website Search by creating a custom search form for your WordPress website.
Why Create a Search Form for a WordPress website?
The WordPress default search feature is limited and may not always find relevant content. So to improvise your web search and help your visitors quickly and easily find the content on your site, you must create a search form for your website.
Moreover, if you have a multiuser website or an online store, you may want users to find the right thing to increase the user experience and simultaneously lower bounce rates.
If users don’t find what they’re looking for, they may not stick around because competitors are just a Back click away. Therefore, Search can help prevent users from leaving your site and finding new content, which will boost the site’s SEO.
Adding a search form to your site
The WordPress installation comes with a default search form widget that can be added to widget areas, such as the sidebar, header, or footer. You can add this widget by two methods: first, through the WordPress Customizer, and second, directly from the dashboard.
You can also create a custom WordPress search form with the free plugin described below.
- Using the WordPress Customizer
The WordPress Customizer allows you to add the search form.
Go to your WordPress dashboard and head over to Appearance>> Customize.
Next, Select Widgets in the Customizer sidebar.
You will bring to a new menu with a list of the widget areas on your site.
Now, click the Add a Widget option and choose the Search widget.
This will add the search widget to the list at the end.
You can replace it to a different place where you want to display it and also add up a title to the search form by entering a title in the Title field. This will include a header outside the search box.
After finishing up, Click on the Publish button to save your changes.
- Adding a search form from the WordPress dashboard.
To add the search form directly from the WordPress dashboard,
go to Appearance>> Widgets option to open the widget editor.
Find out the Search widget from the list and move it to the area you want to place it.
You can add a title to the search form or reorder it to change its position.
Note: Your theme controls the customizer options and specific widget areas. Every theme does not include the same options.
If any of the above options are unavailable on your site, your theme does not support that.
How to create a custom search form
WordPress default search form doesn’t support many customization options. You can only change its position and add a title as mentioned above.
However, you can customize it by editing the code directly. You can create a customized search page for your site using WordPress template files. WordPress.org has explained how to create a search page if you like to do this manually.
However, this method is also limited. You can place the form in your widget areas, and its Appearance will be based on the theme you are using. Which overall does not provide more customization options.
Luckily, You can customize your search form by using a WordPress plugin.
Creating a custom search form with a plugin
For creating a custom WordPress search form, You can use the Ivory Search – WordPress Search Plugin.
1. Install and Activate
You can check our post on how to install and activate WordPress plugin or follow the below steps to install it.
Go to plugins >> Add new >> Search Ivory Search >> Install >> Activate.
It is a free plugin that helps you modify the Appearance of the search bar, place it in your site’s menu, and customize the content appearance in the results.
When activated, proceed to the next step.
2. Create A Search form
After activation, you can create your search form.
Next, go to Ivory Search >> Search Forms.
The plugin will automatically set its default settings. You can get started quickly or customize the settings completely.
The Search tab lets you configure searchable contents. You can specify what content you want to include in searches on your site. Click each section to check and uncheck various post and page types.
The Exclude tab allows you to select specific posts and pages that you don’t want to include in the search results.
Then the Design tab lets you customize the search form appearance.
The Customizer is turned off by default. You may need to click on Enable Search Form Customization.
After that, you can select the Customizer link to open the Customizer.
Now, you can choose the style of the search box and the text and colors used for different.
When you are done, Don’t forget to click on the Publish button to save your settings.
Lastly, the Options tab lets you configure the search results page.
You can adjust the number of results per post, highlight search terms, and more. After finishing up, click on the Save button to update your changes.
3. Add the search form to your website
After configuring your settings, you can add the search form to your website.
You can set the search form wherever you want, such as the header, footer, or WordPress menu.
For example, to add it to your site’s header or footer, head over to Ivory Search >> Settings.
Then, select Header-Search or Footer-Search from the list, and click on the form you created from the drop-down. ( We added the search form to our header.)
After finishing up, click the Save button to update your settings.
To add the search form to the site menu, head over to Ivory Search >> Menu Search.
Now, select the menu where you want to add your search form.
The plugin will add up a magnifying glass to the menu.
When you click the magnifying glass, a search box will pop up to enter the search terms.
After all these steps, you have customized the search form to your site.
To Conclude- The search form lets users find content on your site. WordPress default Search form does not support many customizations options. Therefore, to improvise your web search and user experience, this tutorial explained how you could create a WordPress Search Form and a customized search form for your WordPress site.
To know more about the search form Visit our guide on how to add a search form in a WordPress post with a shortcode.