bp_get_the_body_class

Filters the BuddyPress classes to be added to body_class().

Description

apply_filters( 'bp_get_the_body_class', (array) $classes, (array) $bp_classes, (array) $wp_classes, (array) $custom_classes ); 

Parameters (4)

0. $classes (array)
Array of body classes to add.
1. $bp_classes (array)
Array of BuddyPress-based classes.
2. $wp_classes (array)
Array of WordPress-based classes.
3. $custom_classes (array)
Array of classes that were passed to get_body_class().

Usage

To run the hook, copy the example below.
  1. $classes = apply_filters( 'bp_get_the_body_class', $classes, $bp_classes, $wp_classes, $custom_classes ); 
  2.  
  3. if ( !empty( $classes ) ) { 
  4.  
  5. // everything has led up to this point... 
  6.  
  7.  
The following example is for adding a hook callback.
  1. // define the bp_get_the_body_class callback 
  2. function filter_bp_get_the_body_class( $classes, $bp_classes, $wp_classes, $custom_classes ) { 
  3. // make filter magic happen here... 
  4. return $classes
  5. }; 
  6.  
  7. // add the filter 
  8. add_filter( 'bp_get_the_body_class', 'filter_bp_get_the_body_class', 10, 4 ); 
To remove a hook callback, use the example below.
  1. // remove the filter 
  2. remove_filter( 'bp_get_the_body_class', 'filter_bp_get_the_body_class', 10, 4 ); 

Defined (1)

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

/bp-core/bp-core-template.php  
  1. return apply_filters( 'bp_get_the_body_class', $classes, $bp_classes, $wp_classes, $custom_classes );