bbp_restore_all_filters( string $tag, int $priority = false )
Restores filters from the $bbp global that were removed using bbp_remove_all_filters()
Description
Parameters
- $tag
-
(Required)
- $priority
-
(Optional)
Default value: false
Return
(bool)
Source
File: bp-forums/core/theme-compat.php
function bbp_restore_all_filters( $tag, $priority = false ) {
global $wp_filter, $merged_filters;
$bbp = bbpress();
// Filters exist
if ( isset( $bbp->filters->wp_filter[$tag] ) ) {
// Filters exist in this priority
if ( !empty( $priority ) && isset( $bbp->filters->wp_filter[$tag][$priority] ) ) {
// Store filters in a backup
$wp_filter[$tag][$priority] = $bbp->filters->wp_filter[$tag][$priority];
// Unset the filters
unset( $bbp->filters->wp_filter[$tag][$priority] );
// Priority is empty
} else {
// Store filters in a backup
$wp_filter[$tag] = $bbp->filters->wp_filter[$tag];
// Unset the filters
unset( $bbp->filters->wp_filter[$tag] );
}
}
// Check merged filters
if ( isset( $bbp->filters->merged_filters[$tag] ) ) {
// Store filters in a backup
$merged_filters[$tag] = $bbp->filters->merged_filters[$tag];
// Unset the filters
unset( $bbp->filters->merged_filters[$tag] );
}
return true;
}
Changelog
| Version | Description |
|---|---|
| bbPress (r3251) | Introduced. |
Questions?
We're always happy to help with code or other questions you might have! Search our developer docs, contact support, or connect with our sales team.