How to Hide Search Form if User Not logged-in in BuddyPress Site

Prem Tiwari - - BuddyPress, Code Snippets


In this tutorial, I will explain how to hide search form if user not logged-in in BuddyPress site. This is a simple and easy BuddyPress snippet which will hide the BuddyPress search form if the user logged out.

How to Hide Search Form if User Not logged-in in BuddyPress site

How to Remove Search Form if User Not logged-in in ByddyPress

In this code we have used the CSS property display: none; within the PHP code to hide the search form. Open the functions.php file and add the following snippet at the end of the file.

If you don’t want to edit your functions.php file, then create a new file as bp-custom.php inside the /wp-content/plugins/ folder and add the above code.

After adding the above code the search form will be hidden for the visitors.


About: Prem Tiwari

Prem Tiwari is the founder of FreeWebMentor.com and also 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.


Tags: , , , , , ,