You are on page 1of 20

11/11/22, 12:14 PM How to Create a Custom WordPress Search Form

Conversion Rate Optimization Blog


Practical tips to boost your site conversions.

How to Create a Custom WordPress Search Form


by Rahul Lakhwani on July 11, 2022

Looking for an easy way to add a custom WordPress search form?

Search forms help visitors find the content on your website. It makes content discoverability
easy, which in fact boosts user experience on your website.
WIN A MACBOOK AIR THIS
In this tutorial, we’ll show how BLACK FRIDAY!
you can easily create a custom WordPress search form in just
a few steps. CLICK TO ENTER NOW!
13 21 45 34
DAYS HOURS MINUTES SECONDS

https://optinmonster.com/how-to-create-custom-wordpress-search-form/ 1/20
11/11/22, 12:14 PM How to Create a Custom WordPress Search Form

Why Do You Need A Custom Search Form? ☰

Search is one of the primary ways visitors navigate the Internet. Visitors who find what they
need quickly are more likely to stay on your site. Visitors who stick around can then join
your email list, purchase a product, or take some other step in your sales funnel.

Unfortunately, the regular search function on WordPress only searches post titles and
content. Custom fields, product details, and other important information are completely
ignored. The default search function also can’t search by category and subcategory.

All of this other post information could help your visitors find their way through your site
better and reduce your bounce rate. So how do we get this data into WordPress search?

The solution is to create a custom search form. We’ll show you how in the next section.

Creating a Custom WordPress Search Form

WIN A MACBOOK AIR THIS


BLACK FRIDAY!
SearchWP is the best WordPress search plugin. It’s easy to useCLICK TO ENTER
and comes NOW!
with powerful
13 21 45 34
search features missing in the default WordPress search widget.
DAYS HOURS MINUTES SECONDS

https://optinmonster.com/how-to-create-custom-wordpress-search-form/ 2/20
11/11/22, 12:14 PM How to Create a Custom WordPress Search Form

SearchWP plugin replaces the default WordPress search widget and easily integrates with

popular themes and page builders without any extra effort needed.

It’s the most advanced search plugin available, and more than 30,000 business owners use
SearchWP on their websites.

Here are some of the vital features that make SearchWP stand out from the competition:

Live Search Results: Live search results make it easier to see all the matching results
in the same place without navigating to a different search results page.

Autocomplete Search: SearchWP offers to autocomplete search feature similar to


Google and Bing search engines.

Custom Fields Support: You can search for the matching results within custom fields
missing in the default WordPress search widget.

Search Algorithm: Create a customizable search engine that displays results based
on your inclusion and exclusion rules.

Search Analytics and insights: Get complete access to the analytics reports and
check what visitors search for.

And many more.

Let’s get started with the actual steps to add a custom WordPress search form.

Step 1: Add the SearchWP Plugin

Our first step is to set up the SearchWP plugin.

For that, you need to visit the plugin pricing page and signup for an account. SearchWP is
available in three different pricing plans.
WIN A MACBOOK AIR THIS
BLACK FRIDAY!
CLICK TO ENTER NOW!
13 21 45 34
DAYS HOURS MINUTES SECONDS

https://optinmonster.com/how-to-create-custom-wordpress-search-form/ 3/20
11/11/22, 12:14 PM How to Create a Custom WordPress Search Form

We’ll be opting for the SearchWP Pro plan because it unlocks many powerful extension
plugins.

Once you select the plan, go ahead and complete the purchase process.

Next, log in to your SearchWP account and click on Download SearchWP. Now you can
install the plugin on your website and activate it.

WIN A MACBOOK AIR THIS


BLACK FRIDAY!
CLICK TO ENTER NOW!
13 21 45 34
DAYS HOURS MINUTES SECONDS

https://optinmonster.com/how-to-create-custom-wordpress-search-form/ 4/20
11/11/22, 12:14 PM How to Create a Custom WordPress Search Form

It’s time to activate the license key.

Navigate to Settings » License and enter your license key.

Click on the Activate button.

Next, we can move on to downloading the SearchWP Shortcode extension.

Step 2: Install theWIN A MACBOOK


SearchWP AIR THISExtension
Shortcode
BLACK FRIDAY!
CLICK TO ENTER NOW!
13 21 45 34
DAYS HOURS MINUTES SECONDS

https://optinmonster.com/how-to-create-custom-wordpress-search-form/ 5/20
11/11/22, 12:14 PM How to Create a Custom WordPress Search Form

SearchWP plugin provides shortcodes for adding search forms on your website.

Shortcodes simplify adding a search form, and anyone without technical knowledge can
easily follow this method.

Let’s go ahead and install the SearchWP Shortcode Extension plugin.

You can download the extension from your account by going to the Extensions menu.

Scroll down on the page and click on the Shortcodes plugin.

Next, click on the Download available with active license button.

Now, you can install and activate the extension plugin like installing any other plugin.

That’s it.

We can go ahead and create your first SearchWP search engine.


WIN A MACBOOK AIR THIS
BLACK FRIDAY!
Step 3: Create a Search Engine45 CLICK TO ENTER NOW!
13 21 34
DAYS HOURS MINUTES SECONDS

https://optinmonster.com/how-to-create-custom-wordpress-search-form/ 6/20
11/11/22, 12:14 PM How to Create a Custom WordPress Search Form

SearchWP allows you to create a customizable search engine. You’re in complete control to

display the search results and even rank them in a specific order.

Let’s proceed to build your first search engine.

Navigate to the SearchWP menu » Settings » Engines and click on the Add New button.

This will create a new search engine called supplemental. You can easily change the name
by going to Sources & Settings.

Here, you can select the sources like posts, pages, custom post types, taxonomies,
comments, and so on. SearchWP will try finding the matching results in these places
whenever a visitor searches for something.

WIN A MACBOOK AIR THIS


BLACK FRIDAY!
CLICK TO ENTER NOW!
13 21 45 34
DAYS HOURS MINUTES SECONDS

https://optinmonster.com/how-to-create-custom-wordpress-search-form/ 7/20
11/11/22, 12:14 PM How to Create a Custom WordPress Search Form

There’s also something called Keywords Stems, which is selected by default. Keyword
Stems look for word matching results even if the exact words are not found on your
website.

You can change the search engine name by entering your preferred name in the Engine
label field. We’ll keep it untouched for the sake of this tutorial.

WIN A MACBOOK AIR THIS


BLACK FRIDAY!
CLICK TO ENTER NOW!
13 21 45 34
DAYS HOURS MINUTES SECONDS

https://optinmonster.com/how-to-create-custom-wordpress-search-form/ 8/20
11/11/22, 12:14 PM How to Create a Custom WordPress Search Form

Click on the Done button once you’ve configured the settings.

Next, we need to specify the attributes of your search engine. Attributes refer to the title of
a post, excerpt, slug, and the content part.

Go ahead and click on the Add/Remove Attributes button. It will open a popup wherein
you can check the post attributes.

WIN A MACBOOK AIR THIS


BLACK FRIDAY!
CLICK TO ENTER NOW!
13 21 45 34
DAYS HOURS MINUTES SECONDS

https://optinmonster.com/how-to-create-custom-wordpress-search-form/ 9/20
11/11/22, 12:14 PM How to Create a Custom WordPress Search Form

Click Done once you select the attributes.

If you want to add some specific search rules, you can use the Edit Rules feature. This
feature helps you determine the inclusion and exclusion rules for search terms.

WIN A MACBOOK AIR THIS


BLACK
For example, you can create rules FRIDAY!only in specific taxonomies like categories
for searching
and tags or posts published within a particular date range. CLICK TO ENTER NOW!
13 21 45 34
DAYS HOURS MINUTES SECONDS

https://optinmonster.com/how-to-create-custom-wordpress-search-form/ 10/20
11/11/22, 12:14 PM How to Create a Custom WordPress Search Form

While setting the conditions for search results, you might have noticed the sliders available
in the settings. These sliders set the search relevancy and display results as per the
relevancy range.

Finally, you can click on Save Engines to save your engine.

Step 4: Add the Search Form to Your Website

The last step is to add the search form shortcode to your website.
WIN A MACBOOK AIR THIS
BLACK FRIDAY!
You can add the search code within posts, pages, navigation menu, and sidebar.
CLICK TO ENTER NOW!
13 21 45 34
DAYS HOURS MINUTES SECONDS

https://optinmonster.com/how-to-create-custom-wordpress-search-form/ 11/20
11/11/22, 12:14 PM How to Create a Custom WordPress Search Form

Let’s add the search form on a post or a page.


Open the post where you want to add the search form. Click on the + Add icon to add an
HTML block.

Copy the following code in the custom HTML block.

1 [searchwp_search_form engine="custom" var="searchvar" button_text="Custom


Search"]
2  
3 <div class="search-results-wrapper">
4 [searchwp_search_results engine="custom" var="searchvar" posts_per_page=4]
5 <h2>[searchwp_search_result_link direct="true"]</h2>
6 [searchwp_search_result_excerpt]
7 [/searchwp_search_results]
8 </div>
9  
10 <div class="no-search-results-found">
11 [searchwp_search_results_none]
12 No results found, please search again.
13 [/searchwp_search_results_none]
14 </div>
15  
16 <div class="search-results-pagination">
17 [searchwp_search_results_pagination
WIN A MACBOOK AIR direction="prev"
THIS link_text="Previous"
var="searchvar" engine="custom"]
18 BLACK FRIDAY!direction="next" link_text="Next"
[searchwp_search_results_pagination
var="searchvar" engine="custom"] CLICK TO ENTER NOW!
19 </div> 13 21 45 34
DAYS HOURS MINUTES SECONDS

https://optinmonster.com/how-to-create-custom-wordpress-search-form/ 12/20
11/11/22, 12:14 PM How to Create a Custom WordPress Search Form

Click on the Publish or Update button to save the changes.


Open the post, and you should see the newly added search form.

Here’s how it looks in the front.

It’s time to check the working of the form.

For example, we’ll search for WooCommerce.

WIN A MACBOOK AIR THIS


BLACK FRIDAY!
CLICK TO ENTER NOW!
13 21 45 34
After performing the search, we received all the matching results in just a few seconds.
DAYS HOURS MINUTES SECONDS

https://optinmonster.com/how-to-create-custom-wordpress-search-form/ 13/20
11/11/22, 12:14 PM How to Create a Custom WordPress Search Form

That’s it.

You’ve successfully added a custom WordPress search form to your website.

Since SearchWP offers plenty of extension plugins, you can check more details about the
integrations and easily extend the core functionality of the search form.

We hope you liked this easy to follow tutorial. If you did, don’t forget to check the below
articles to improve the search features on your business website.

How to Add a Custom Search Bar to WordPress (Step by Step)

SearchWP Review: Is It the Best WordPress Search Plugin?

15 Best WordPress Search Plugins for Your Site (Compared)

What are you waiting for? Get started with SearchWP today!

If you liked this tutorial, follow us on Facebook and Twitter for more free WordPress
tutorials.

Published by Rahul Lakhwani


Rahul is a content marketer and web developer. He keeps learning about new web
development trends and helps people do online businesses. He enjoys watching
YouTube videos and reading psychology books in his free time.

WIN A MACBOOK AIR THIS


12 Proven BLACK
WaysFRIDAY!
to Convert Abandoning
13Visitors
21 into
45 Subscribers
CLICK TO ENTER NOW!
34
DAYS HOURS MINUTES SECONDS

https://optinmonster.com/how-to-create-custom-wordpress-search-form/ 14/20
11/11/22, 12:14 PM How to Create a Custom WordPress Search Form

Over 70% of visitors who abandon your


website will never return! ☰

Learn how to unlock the highest


conversion revenue from each of your
website visitors!

DOWNLOAD NOW

Add a Comment

We're glad you have chosen to leave a comment. Please keep in mind that all comments
are moderated according to our privacy policy, and all links are nofollow. Do NOT use
keywords in the name field. Let's have a personal and meaningful conversation.

Your Comment

Your Real Name


*
Your Best Email Address *
WIN A MACBOOK AIR THIS
Save my name, email, and website
BLACKin thisFRIDAY!
browser for the next time I comment.

CLICK TO ENTER NOW!


Add Your Comment 13 21 45 34
DAYS HOURS MINUTES SECONDS

https://optinmonster.com/how-to-create-custom-wordpress-search-form/ 15/20
11/11/22, 12:14 PM How to Create a Custom WordPress Search Form

Join Over 235,335


subscribers to get free conversion optimization tips and resources.

Your Real Name...

Your Best Email Address...

Yes, I'm committed to learning how to grow my lists, leads and sales!

SUBSCRIBE
WIN A MACBOOK AIR NOW
THIS
BLACK FRIDAY!
CLICK TO ENTER NOW!
13 21 45 34
Connect With Us DAYS HOURS MINUTES SECONDS

https://optinmonster.com/how-to-create-custom-wordpress-search-form/ 16/20
11/11/22, 12:14 PM How to Create a Custom WordPress Search Form

    ☰

Blog Topics

A/B Testing

Announcements

Case Studies

Content Marketing

eCommerce

Email Marketing

Lead Generation

Tutorials

WordPress

Popular Posts

SEO Made Easy—Ultimate Guide to


Explode Your Traffic In 2022

32 Best Shopify Apps to Increase Sales


Now (2022)

40 Exit Popup Hacks and Examples to


Grow Your Email List

50 Email Segmentation Tips You Need to


Use Now

The Ultimate Guide to Growth Hacking for


WIN A MACBOOK AIR THIS
Exponential Success in 2022
BLACK FRIDAY!
37 Best WordPress Plugins & Tools for CLICK TO ENTER NOW!
2022 13 21 45 34
DAYS HOURS MINUTES SECONDS

https://optinmonster.com/how-to-create-custom-wordpress-search-form/ 17/20
11/11/22, 12:14 PM How to Create a Custom WordPress Search Form

29 Best Email Automation Tools to


Transform Your Business ☰

12 Best Online Giveaway Tools To Get New


Leads FAST

Search …

Get More Subscribers & Customers NOW


Unleash the power of OptinMonster on your website today!

Get Started Now

 300+ 5-star ratings  14 day money-back guarantee  Trusted by 1m+ websites

Company

University

Press

Testimonials

About

Contact

Blog

Affiliates

Careers
WIN A MACBOOK AIR THIS
BLACK FRIDAY!
CLICK TO ENTER NOW!
Top Features 13 21 45 34
DAYS HOURS MINUTES SECONDS

https://optinmonster.com/how-to-create-custom-wordpress-search-form/ 18/20
11/11/22, 12:14 PM How to Create a Custom WordPress Search Form
Lightbox Popup

Exit-Intent® Technology ☰

Fullscreen Welcome Mat

Floating Bar

Slide-in Scroll Box

Inline Forms

A/B Testing

Conversion Analytics

Yes / No Forms

OnSite Retargeting®

MonsterLinks™

MonsterEffects™

Page-Level Targeting

Geo-Location Targeting

OnSite Follow Up Campaigns®

InactivitySensor™

Helpful Links

Login

Support

Documentation

Plans and Pricing

Product Tour

Integrations

Popup Examples

OptinMonster Alternatives

WIN A MACBOOK AIR THIS


BLACK FRIDAY!
    CLICK TO ENTER NOW!
13 21 45 34
DAYS HOURS MINUTES SECONDS

https://optinmonster.com/how-to-create-custom-wordpress-search-form/ 19/20
11/11/22, 12:14 PM How to Create a Custom WordPress Search Form

Copyright © 2013 - 2022 Retyp, LLC.

OptinMonster®, Exit Intent®, OnSite Retargeting® and OnSite Follow Up Campaign® are registered trademarks of Retyp, LLC. ☰

Our Sites
TrustPulse
WPForms
MonsterInsights
WPBeginner
All In One SEO
IsItWP
SeedProd
WP Mail SMTP
RafflePress

Terms of Service | Privacy Policy | Security | GDPR | Sitemap | OptinMonster Coupon

WIN A MACBOOK AIR THIS


BLACK FRIDAY!
CLICK TO ENTER NOW!
13 21 45 34
DAYS HOURS MINUTES SECONDS

https://optinmonster.com/how-to-create-custom-wordpress-search-form/ 20/20

You might also like