How to Add a Search Box to Your WordPress Menu

| Last Updated: | In: WordPress, WordPress Snippets


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

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.


About: Prem Tiwari

Prem Tiwari is the founder of freewebmentor.com and is a professional developer who has vast experience in PHP and open source technologies. Apart from this, he is a blogger by hobby and also he has been a regular speaker of WordPress sessions in various IT Companies.


You may also like:


, , , , , , , ,