bp_restore_all_filters( string $tag, int|bool $priority = false )
Restore filters that were removed using bp_remove_all_filters().
Description
Parameters
- $tag
-
(Required) The tag to which filters should be restored.
- $priority
-
(Optional) If present, only those filters that were originally attached to the tag with $priority will be restored. Otherwise, all available filters will be restored, regardless of priority.
Default value: false
Return
(bool) True on success.
Source
File: bp-core/bp-core-theme-compatibility.php
function bp_restore_all_filters( $tag, $priority = false ) {
global $wp_filter, $merged_filters;
$bp = buddypress();
// Filters exist.
if ( isset( $bp->filters->wp_filter[$tag] ) ) {
// Filters exist in this priority.
if ( ! empty( $priority ) && isset( $bp->filters->wp_filter[$tag][$priority] ) ) {
// Store filters in a backup.
$wp_filter[$tag][$priority] = $bp->filters->wp_filter[$tag][$priority];
// Unset the filters.
unset( $bp->filters->wp_filter[$tag][$priority] );
// Priority is empty.
} else {
// Store filters in a backup.
$wp_filter[$tag] = $bp->filters->wp_filter[$tag];
// Unset the filters.
unset( $bp->filters->wp_filter[$tag] );
}
}
// Check merged filters.
if ( isset( $bp->filters->merged_filters[$tag] ) ) {
// Store filters in a backup.
$merged_filters[$tag] = $bp->filters->merged_filters[$tag];
// Unset the filters.
unset( $bp->filters->merged_filters[$tag] );
}
return true;
}
Changelog
| Version | Description |
|---|---|
| BuddyPress 1.7.0 | 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.