SearchWP Documentation

View the installation guide, browse the Knowledge Base, find out about SearchWP’s many hooks

Search Forms

SearchWP simplifies the process of adding custom search forms to your website, removing the need for coding skills. There’s no need to alter theme files or use additional plugins for search functionality — SearchWP’s Search Form feature has you covered. You can design search forms with various layouts and customize them by choosing different engines and templates for your search results.

Embedding these search forms into your website is easy and can be done on any page or template using Gutenberg blocks, shortcodes, or PHP code, making it a straightforward solution for improving your website’s search capabilities.

Create a New Search Form

To get started with Search Forms, navigate to the Search > Search Form page and select “Add New” to initiate a new search form.

On the next page, various customization options for the Search Form will be available to you. The options are divided in 2 sections: “Choose a theme” and “Custom Styling”.

Choose a theme

In this section, you can switch between the different layouts of the search form. For each selected layout, you can also preview how it will display on the front end of your site.

Layout Theme: Select a layout theme for your Search Form from a variety of predefined settings, which you can customize to fit your needs. Below are the available form themes:

  1. Basic: A simple form with a search button without any filter options.
  2. Category Search: This form includes a search button along with a category filter, allowing users to refine their search results based on the selected category.
  3. Quick Search: Offers a search form that displays a list of popular search terms which provides users with faster access to their search results.
  4. Advanced Search: This layout introduces a toggle for additional filtering options such as Authors, Post Types, and Tags, helping users narrow down the search results based on dropdown values.
  5. Combined: This option allows the creation of a custom search form using any combination of the options present in the Custom Styling section.

Custom Styling

This section offers a variety of functional and design choices that allow you to tailor the search form to meet your specific needs.

Category Search: When activated, this feature displays a select dropdown for Post Categories, enabling users to filter search results by a chosen category term. By default, WordPress categorizes only Posts, but there are plugins that add categories to Pages and other post types as well. Category Search filter works with all of those. You can add or remove the terms for the filter dropdown from the Select Category field.

Quick Search: This feature allows for the addition of multiple quick search terms, designed to redirect users directly to their search results page. These terms should be inputted into the Quick Search Items field within the Search Form. For security reasons, the system requires that these items be manually inputted into the Quick Search Items field.

Advanced Search: This feature enables you to refine your search results by Authors, Post Types, and Tags. Initially, all filter options are included. However, you can easily choose which filters to use or not use by adjusting the selections in the Advanced Search Filters field.

Engine: Here, you can select the search engine to be used by the Search Form. This selection is based on the engines you’ve set up in the Engine settings page. The Default engine is selected automatically, but you have the option to switch to a supplemental engine if one is available.

Results Page: The Results Page setting is one of the most important fields in your search form configuration. It determines which template is used to display the search results when someone performs a search using your form. You have two options:

  1. Site Default Template
    This option uses the default search template from your active WordPress theme. It’s suitable if your theme already includes a well-designed search results page. However, to make any design or layout changes, you’ll need to manually edit your theme’s search.php or equivalent template file.
  2. SearchWP Template
    Selecting this option enables you to display results using a custom-designed template created under the Templates section of the SearchWP plugin. This gives you full control over the design and layout of the results without editing any theme files.

Note: If you are using a supplemental engine that includes custom sources like taxonomies or users, you must use the SearchWP Template to properly display the results. The default theme template does not support these custom result types.
Alternatively, you can modify the default theme template to retrieve the search results using the \SearchWP\Query() class, as described here. However, this approach is recommended only for advanced users. 

Target Page: The Target Page option becomes available when you select SearchWP Template as your Results Page option. This field allows you to choose any existing page on your website to act as the display page for SearchWP results.

You can select a dedicated results page (such as “Search Results”) or create a new page specifically for this purpose. The SearchWP template will render on this page whenever users perform a search through the associated form.

Template: This setting allows you to choose which SearchWP template should be used to display the results.

By default, SearchWP includes a pre-made template when the plugin is installed. However, you are free to create multiple custom templates from the Templates settings page and apply them as needed.

For example, you could create one template for blog post searches, another for product results, and a third for member directory lookups. This flexibility lets you customize the design and layout of search results for different areas of your site.

Type of Search: The Type of Search field allows you to define which content types (post types or sources) are included in the search results. The available options depend on the engine you’ve selected for the form.

This feature is especially useful when you want to create different search forms targeting specific types of content, such as blog posts, products, pages, or users—all using the same search engine.

Note: If you want your form to search all sources configured in your engine, simply leave this field empty. This ensures that the search pulls results from every available post type defined in the engine settings.

Select Category: This allows you to manage which categories appear in the category filter dropdown. Turning on the category filter for the first time automatically includes all categories. If you remove all categories from this field, the category filter will disappear from the search form on your website.

Field Label: Use this area to set the placeholder text for the search form. If left blank, the form will not show any placeholder text.

Search Button: This switch lets you decide whether to show or hide the search button on your form.

Quick Search Items: Here, you can input terms for the quick search feature. New forms have the quick search items already pre-populated with the top 10 most searched terms. When you place the cursor in the field, it will suggest additional terms based on your site search statistics. You can modify your desired search phrases or keywords and then press enter.

Advanced Search Filter/s: In this option, you can add or remove filters for authors, post types, and tags to refine your advanced search options. The authors dropdown will list all authors of WordPress Posts. Selecting a post type will limit the options to those you’ve included in the Type of Search field. The tags dropdown will show tag terms associated with Posts.

Form Style: Here, you can customize how your search form looks. You can adjust things like the form’s border style, border color, and the size of the text within the search form.

Button Style: This section allows you to tweak the appearance of the search button. This includes updating the button label text, background color, font color, and font size

Embed a Search Form

SearchWP offers four methods to integrate a search form into any page on your website:

Gutenberg Block: To embed a search form on any post or page using the Gutenberg editor, follow these steps:

  1. Open the desired post or page in the Gutenberg editor.

  2. Click the “+” (Add Block) button and search for “Search Form”.

  3. Choose the Search Form block from the available options.

  4. Once added, go to the block settings in the right-hand panel and use the dropdown to select a specific search form you’ve created in the Search Form settings.

Shortcode: Simply copy and paste the provided shortcode into any post or page to embed the Search Form where you want it to appear.

PHP code: Insert the PHP code into your theme’s post template or a code snippet to display the customized Search Form on your site.

Embed Terms: You can easily add a Search Form block to an existing page by choosing it from the dropdown menu, or you can opt to create a new page specifically for the block.

Create a Better WordPress Search Experience Today

Never lose visitors to unhelpful search results again. SearchWP makes creating your own smart WordPress search fast and easy.

Get SearchWP Now
Multiple Search Engines Icon