bp-custom.php vs. functions.php

Up until today I did not know the difference between bp-custom.php and functions.php within a BuddyPress installation. It turns out that bp-custom.php is basically a functions file that is theme-independent. What that means is that if you have a function that you want to run irrespective of whatever theme is active, you put it in bp-functions.php.

Pretty nifty!

Posted in ,

Toby Cryns

Toby Cryns is a freelance CTO, expert WordPress consultant, and teacher.

He offers free advice to improve your freelance biz.

He also publishes small droppings every now and then to twitter.com/tobycryns and twitter.com/themightymo

Follow Toby's contributions on Github and WP.org.

2 Comments

  1. Boone Gorges on May 14, 2012 at 10:46 pm

    Also: bp-custom.php is loaded as soon as the plugin files are included (https://core.trac.wordpress.org/browser/tags/3.3.2/wp-settings.php#L194) while functions.php doesn’t get included until the theme gets set up (https://core.trac.wordpress.org/browser/tags/3.3.2/wp-settings.php#L281). This sometimes makes a difference when you want to change, eg, certain initialization constants for BP, in which case functions.php is too late. Whee!



    • toby on May 15, 2012 at 4:16 pm

      Right on, Boone! Thanks for the extra info!