Want to make a WordPress custom search form? This guide shows you how to create a custom search form for any WordPress website and any purpose!
Approximate read time: 8 minutes
The default WordPress search is fine, but it feels a bit limiting.
A WordPress custom search form gives you more control over its look, functionality, and even what it returns. Whether it's to improve user experience, track searches, or match a brand, creating a custom search form solves many problems.
Make a custom search form now!
And that's why I wrote this guide. I'll show you how to build a WordPress custom search form in a few steps that can be adapted for any purpose.
Let's get started.
Why use a WordPress custom search form?
WordPress already has a built-in search bar, so why bother creating one?
There are actually quite a few benefits. And depending on your needs, here are a few:
- Control the look: A custom form can be designed to match a website perfectly instead of just a standard search box.
- Search more than blog posts: Sometimes there's more (or less) that you want people to search. A custom search feature allows control over the entire form.
- Add extras: Include filters (like dates or categories) or make the search bar more visible.
- Track user behavior: Learn more about what visitors are interested in to give them better content or products. It's a win for both sides.
Ultimately, a custom search form is the way to go if you need more control over a WordPress website and want to build a search form that suits each website's needs.
How to add a custom search form to a WordPress website
The best solution to create a custom WordPress search form is Formidable Forms.
It's the best WordPress form builder, creating advanced forms in a few minutes and saving people time. There are search plugins that add a search bar, but they only have one purpose.
Formidable can create forms and power applications like a custom search form across a website. While this will take some tech-savviness, it's nothing compared to coding one yourself.
Formidable's Views is what powers it all. And it allows anyone to build complex solutions with little to no code. So, grab a plan for Formidable Forms Pro to access Views using the button below.
Then get Formidable installed and activated, and we'll get started.
If you're more of a visual learner, check out the video below:
Otherwise, it's a few easy steps to build a custom WordPress search form:
1. Start an application
This is one reason I suggest using Formidable Forms Pro.
Its applications are powerful tools any business can use to upgrade a website. There are many pre-made WordPress application templates already (like a Real Estate Listing), but this one will be from scratch.
Get access to application templates today!
So, go to Formidable → Applications in the WordPress dashboard, and click the Add New button. Then, give the application a name, and click Create empty application.
This is the foundation of the custom search form. This will house the form for the data people will search, the form for people to search, and the results.
2. Build a data form and enter data
First up to add a search form is the data form.
This is the form that houses all the data that will be searched. Think real estate listings, documents, videos, or even webpages.
In the application, click Add Item → New Form next to Add a form. Next, click the Create a blank form button at the top of the page.
Next, add fields to gather the information for what people will search for on the site.
For example, if I had a movie review site, and people would search for movie titles, I'd build a form to gather the data someone may search for. So, my form may look like this:
I can add other fields later if needed. But this should get the primary information to start entering movies to form my database.
Customize the form to match the website's needs, then click Save to update and give the form a name. Next, the form needs a few submissions to create the database for the next step.
So, click the Entries tab at the top of the page.
Then, click the Add New button to create an entry. Repeat this process as many times as necessary.
Once this is finished, it's time to create the view to show these entries so they can be searched!
3. Create a results view
Next, go to the application dashboard again, click the Add Item button, and click New View.
Then, Choose the type of layout to use. I'll use Grid to show the movie results. After, give the view a name, and choose the form created in the previous step under Use Entries from Form.
The plugin opens the View editor, which customizes the view. For example, I've added a single-column layout on the Listing Page with the shortcodes for the information I collected in the form.
Now, this would be a very basic listing. So, I'll add movie images to make it look better.
So, first, I'll have to change my layout to a two-column layout and then add the shortcodes. In the end, it'll look something like this.
Now, it's time to display the results page using a bit of shortcode.
So, jot down the View ID. You'll need it in the next step. To find it, click the Embed button, then click Insert manually. The ID is the number after id= under the WordPress shortcode.
4. Design a results page
Under the application dashboard, click the Add Item button again.
Next, click New Page. Give the page a name, and then the plugin will take you to the page editor. On the new page, feel free to add any other items. But, add a new WordPress block and then a Shortcode block. Then, add the following shortcode:
[display-frm-data id="x" filter="1"]
The x will be the view code copied in the previous step. This will display the Results view.
Last, copy the URL of the page for the next step.
Step 5: Create a search form
There are multiple options here.
Formidable has a pre-made search form template, which can speed up the process. Or, one can be built from scratch.
Either way, go to the application dashboard, click Add Item, then click New form. Feel free to add as many fields as needed. I'll keep mine simple and add a movie title field. Remember the Field ID of this field for easy reference in a moment.
Then, I'll update/save the form and go to Settings → Actions & Notifications. Under the Confirmation action, select Redirect to URL. Then, enter the URL copied in the previous step.
Now, add extra parameters to the URL for the field. For example, mine would be:
https://your-site-url.com/search-form?title=[x]
The part after the ? can be whatever you want to name it, but keep it descriptive. And the x will be the ID of the form field on the Search Form from a bit ago.
Mine looks something like this:
Also, delete the Send Email notification while you're in the Actions & Notifications. I'd also recommend checking Do not store entries submitted from this form under Settings → General → On Submit.
Step 6: Filter entries and publish everything
Now it's time to filter the entries in the view and publish the search form!
First, go to the Results View created in step 4. Then, click the Filter Entries link at the top of the view editor. Next, add a filter for each field in the search form. In the last field, type [get param=x], with x being the parameter you put at the end of the Redirect URL.
For mine, I only had one (the title), so I can set it up like this:
Now, it'll automatically take the parameter and filter out any entries that don't match.
So, publish the Search Form on a page or post! Head to the post or page for the form, add a new WordPress block, and then add the Formidable Forms block. Last, choose the form from the dropdown menu.
You can even put this on the results page so it filters on the same page.
The last thing to do is run a test to ensure it works!
If you have trouble, check out our search form docs for help. And if that fails, reach out to our amazing support team, which is ready to help.
Continue building with Formidable Views
This isn't the end of what can be done with Formidable Views. We call it the best WordPress custom application plugin.
But, don't stop with just a search form. Learn how to create a web app in WordPress in a few simple steps! The main tool? You guessed it: Formidable Views!
Also, if you haven't already, grab Formidable Forms Pro by clicking the button below and start building!
And follow us on Facebook, Twitter, and YouTube for more WordPress tips & tricks!
Nawin says
Fair enough
Andy Globe says
Thanks for the tut.
Always learn something when I come over.
Appreciate you taking the time.