How to Add a Search Box to Your WordPress Menu

This is a very short tutorial, which will demonstrate how to add a search box to your WordPress menu bar without using any WordPress plugin.

No need to install any plugin to add a search box to your menu bar, simply follow the below steps for the same.

How to add a search box to your WordPress menu

How to add a search box to your WordPress menu

Open the functions.php file and copy paste below code snippet at the end of the file and save it. Below code will automatically add the search box to your primary menu bar.

By default, it will be displayed as your theme color combination, but if you want to change the style, then you can add your custom styles to search box. In the example, I have added margin to search box from top and right.

If you like FreeWebMentor and you would like to contribute, you can write an article and mail your article to [email protected] Your article will appear on the FreeWebMentor main page and help other developers.

Recommended Posts:


Prem Tiwari

An engineer by profession and a passionate blogger by heart. Founder of FreeWebMentor.com (A Programming blog for beginners), Tech Speaker at various forums. A part from this he is an open source enthusiast, WordPress Lover, Blogger, SEO, and Growth Strategic.

Article Tags: , , , , , , , ,