Select Page

Add this to your functions file to add search to the main menu of your website.

<?php 
//add search to menu
function se_add_search_box_to_menu( $items, $args ) {
    if ( $args->theme_location === 'main' )
        return $items . get_search_form();

    return $items;
}
add_filter( 'wp_nav_menu_items', 'se_add_search_box_to_menu', 10, 2 );
?>