Home › Forums › Support › Search in Menu Bar for logged in users only? This topic has 4 replies, 2 voices, and was last updated 5 years, 10 months ago by Tom. Viewing 5 posts - 1 through 5 (of 5 total) Author Posts June 18, 2018 at 5:44 am #602598 Michael Hi, The search bar in the navigation is perfect, but is there a way I can only display it to logged in users? Reason being it has been used for spam searches, and that counts towards my allowance of the facility. So I only want it displayed for members. Thanks for any help June 18, 2018 at 11:01 am #602899 TomLead Developer Lead Developer Hi Michael, Try this function: add_action( 'wp', 'tu_disable_guest_nav_search' ); function tu_disable_guest_nav_search() { if ( ! is_user_logged_in() ) { remove_filter( 'wp_nav_menu_items', 'generate_menu_search_icon', 10, 2 ); remove_action( 'generate_inside_navigation', 'generate_navigation_search' ); } } Let me know π June 18, 2018 at 11:48 am #602920 Michael Hi Tom, Muchas Gracias π I’ll try it out and report back. June 18, 2018 at 12:29 pm #602950 Michael Works like a charm, thank you π June 18, 2018 at 1:05 pm #602978 TomLead Developer Lead Developer Awesome, glad I could help! π Author Posts Viewing 5 posts - 1 through 5 (of 5 total) You must be logged in to reply to this topic. Log In Username: Password: Keep me signed in Log In