BuddyDev

Search

bp-custom.php is a php file that is loaded before BuddyPress loads anything else. In other words, The BuddyPress plugins looks for the presence of bp-custom.php in the plugins directory and  if it is present It is loaded and BuddyPress continues loading the core components then. If you don’t have this file in your wp-content/plugins directory, please create a file named bp-custom.php there to add the custom codes.

Here is a flow chart to show the process when it is loaded.

 

FAQ:-

Is it required file?

No. It is optional.

What is the benefit of putting code in bp-custom.php instead of theme’s functions.php?

Good question.  Your changes will be gone when you change the theme but the code in bp-custom.php will always be there. It is not dependent on theme. So, use it to keep common codes.

Do I need to create it?

Yes, if it is not present in your wp-content/plugins directory.

What is the purpose of it?

The actual purpose was to allow you run your code before BuddyPress runs but It can be used to hook into various BuddyPress features.

Subscribe