bbp_restore_all_filters

Restores filters from the $bbp global that were removed using bbp_remove_all_filters().

Description

bbp_restore_all_filters( (string) $tag, (bool) $priority = false ); 

Parameters (2)

0. $tag (string)
The tag.
1. $priority — Optional. (bool) => false
The priority.

Usage

  1. if ( !function_exists( 'bbp_restore_all_filters' ) ) { 
  2. require_once ABSPATH . PLUGINDIR . 'bbpress/includes/core/theme-compat.php'; 
  3.  
  4. // The tag. 
  5. $tag = ''; 
  6.  
  7. // The priority. 
  8. $priority = false; 
  9.  
  10. // NOTICE! Understand what this does before running. 
  11. $result = bbp_restore_all_filters($tag, $priority); 
  12.  

Defined (1)

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

/includes/core/theme-compat.php  
  1. function bbp_restore_all_filters( $tag, $priority = false ) { 
  2. global $wp_filter, $merged_filters; 
  3.  
  4. $bbp =bbpress); 
  5.  
  6. // Filters exist 
  7. if ( isset( $bbp->filters->wp_filter[$tag] ) ) { 
  8.  
  9. // Filters exist in this priority 
  10. if ( !empty( $priority ) && isset( $bbp->filters->wp_filter[$tag][$priority] ) ) { 
  11.  
  12. // Store filters in a backup 
  13. $wp_filter[$tag][$priority] = $bbp->filters->wp_filter[$tag][$priority]; 
  14.  
  15. // Unset the filters 
  16. unset( $bbp->filters->wp_filter[$tag][$priority] ); 
  17.  
  18. // Priority is empty 
  19. } else { 
  20.  
  21. // Store filters in a backup 
  22. $wp_filter[$tag] = $bbp->filters->wp_filter[$tag]; 
  23.  
  24. // Unset the filters 
  25. unset( $bbp->filters->wp_filter[$tag] ); 
  26.  
  27. // Check merged filters 
  28. if ( isset( $bbp->filters->merged_filters[$tag] ) ) { 
  29.  
  30. // Store filters in a backup 
  31. $merged_filters[$tag] = $bbp->filters->merged_filters[$tag]; 
  32.  
  33. // Unset the filters 
  34. unset( $bbp->filters->merged_filters[$tag] ); 
  35.  
  36. return true;