Loads your component into the $bp global.



This function loads your component into the $bp global. By hooking to bp_loaded, we ensure that BP_Gifts_Component is loaded after BuddyPress's core components. This is a good thing because it gives us access to those components' functions and data, should our component interact with them.

Keep in mind that, when this function is launched, your component has only started its setup routine. Using print_r( $bp->example ) or var_dump( $bp->example ) at the end of this function will therefore only give you a partial picture of your component. If you need to dump the content of your component for troubleshooting, try doing it at bp_init, ie function bp_example_var_dump() add_action( bp_init,, bp_example_var_dump ); It goes without saying that you should not do this on a production site!


  1. if ( !function_exists( 'bp_gifts_load_core_component' ) ) { 
  2. require_once ABSPATH . PLUGINDIR . 'buddypress-gifts-latest-2014/includes/bp-gifts-loader.php'; 
  5. // NOTICE! Understand what this does before running. 
  6. $result = bp_gifts_load_core_component(); 

Defined (1)

The function is defined in the following location(s).

  1. function bp_gifts_load_core_component() { 
  2. global $bp; 
  4. $bp->gifts = new BP_Gifts_Component;