Skip to main content

The default WordPress search form works well for basic needs, but what if your site needs different search options for various sections — for example, one search for blog posts, another for products, and a third for portfolio items?

Good news: you can easily create and use multiple search forms in WordPress without affecting the default functionality.

In this guide, we’ll show you how to do it — with and without plugins — and customize each search form to fit your specific use case.


Why You Might Need Multiple Search Forms

Having multiple search forms is especially useful when:

  • You have different content types, such as posts, pages, and products.

  • You want a search bar for each section, like “Search Blogs,” “Search Products,” or “Search Services.”

  • You need to limit results to specific categories, tags, or custom post types.

  • You want to improve user experience and navigation for larger websites.


Method 1: Using Custom Code (Recommended for Developers)

You can create multiple custom search forms by copying and modifying the default searchform.php file in your theme.

Step 1: Duplicate and Rename the Search Form

In your theme folder (/wp-content/themes/your-theme/), duplicate the searchform.php file and rename it according to its purpose — for example:

searchform-blog.php  
searchform-products.php  
searchform-portfolio.php

 

 

 

Step 2: Customize Each Form

Open each file and modify the search form markup.
Example for a blog search:

<form role="search" method="get" class="search-form-blog" action="<?php echo home_url( '/' ); ?>">
    <label>
        <span class="screen-reader-text">Search Blogs:</span>
        <input type="search" class="search-field" placeholder="Search Blog Posts…" value="<?php echo get_search_query(); ?>" name="s" />
        <input type="hidden" name="post_type" value="post" />
    </label>
    <button type="submit" class="search-submit">Search</button>
</form>

And for a WooCommerce product search:

<form role="search" method="get" class="search-form-products" action="<?php echo home_url( '/' ); ?>">
    <label>
        <span class="screen-reader-text">Search Products:</span>
        <input type="search" class="search-field" placeholder="Search Products…" value="<?php echo get_search_query(); ?>" name="s" />
        <input type="hidden" name="post_type" value="product" />
    </label>
    <button type="submit" class="search-submit">Search</button>
</form>

Step 3: Display the Correct Search Form

You can include the appropriate form in your template files using:

get_search_form( array( 'echo' => true, 'form' => 'searchform-products.php' ) );

Or you can directly use:

get_template_part( 'searchform', 'products' );

This ensures that the right search form appears on the right page or section.


Method 2: Using a Plugin (For Non-Coders)

If you prefer not to code, you can use a plugin such as:

  • SearchWP

  • Relevanssi

  • Ivory Search

Using Ivory Search

  1. Install and activate the Ivory Search plugin.

  2. Go to Ivory Search → Add New Search Form.

  3. Configure what the form searches (posts, products, categories, etc.).

  4. Save and copy the shortcode.

  5. Paste the shortcode anywhere on your site — in widgets, pages, or headers.

Example shortcode:

 
[ivory-search id="123" title="Blog Search"]

Each form can have different settings, so you can easily create separate searches for blogs, products, or portfolios.


Tips for Better Search UX

  • Use clear labels like “Search Articles” or “Find a Product.”

  • Add placeholder text to guide users.

  • Display results on a dedicated search results page for clarity.

  • Implement live search or AJAX search for faster interaction.

  • Style each form with custom CSS to match your theme.


Final Thoughts

Adding multiple search forms in WordPress helps you deliver a more organized and user-friendly browsing experience. Whether you use custom code or a plugin, you can tailor each search to specific content areas — improving both usability and conversion rates.

Tags