How to Add a Search Form To Main Menu in WordPress How to Add a Search Form To Main Menu in WordPress

How to Add a Search Form To Main Menu in WordPress

When we are looking for certain information on the Web, we use a search engine and type a certain key phrase in the search field to get the results. We get a list of websites in the search results and we click the URLs to find the right site for our purpose.

When we get to a certain web-page, there is always a great amount of information sorted by categories, tags, navigation menus, so we see lots of headings and posts calling us to read them, and this is sometimes really confusing.

When you open a definite site, you see the latest posts displayed on top, so you have to review a good deal of information to find a piece of text, video or image you wanted. This is where a search bar comes in handy.

Most of the WordPress themes come with the search field available by default. It is usually located in the sidebar together with recent posts, comments, categories list, etc. But you can remove the search widget from the sidebar or switch off the sidebar for your theme and locate the search form in the menu.

Why is it convenient to place a search bar in the menu?

When you place a search form into the main menu, a user can find what they are looking for without opening sidebars, scrolling and browsing your inner pages trying to find a search bar.

Stick the search bar to top of your website to make it always visible wherever a user is located. If the search form is situated in the main (primary) menu, it will be displayed on all pages included in this menu. As a result, it will help your users easily find what they want using just a keyword or a phrase.

This will also ease the navigation and even improve conversions. Why? Well, users won’t be forced to review big portions of information instead of finding what they need at once. So they will be able to easily navigate across your website and stay on your web-page for longer without any frustration.

How to add a search bar into the main menu?

For our purpose we will use Add Search to Menu plugin for WordPress. When the plugin is installed and activated, go to Settings -> Add Search to Menu in your admin panel to start configuring the plugin.

Here you can choose the type of menu you want your search bar to be located in. It can be main menu, secondary menu, footer menu, etc.

You’ll be also able to define the search post types, search form style, and even invent the original title for the search menu.

If you change a theme for your website, the list of available menus will be also updated in the plugin’s settings. So, as you see, first there were main and footer menus available, and now it is just a primary menu displayed.

Once selected, the search form will be added to your navigation menu. So here is our menu structure,

And this is how it looks live with a search form added.

As you see, adding a search bar to the menu in WordPress is an easy task thanks to a very simple-to-use WP plugin. Hope this tut is useful for you.