bp_remove_all_filters( string $tag, int|bool $priority = false )
Remove all filters from a WordPress filter hook.
Description
Removed filters are stashed in the $bp global, in case they need to be restored later.
Parameters
- $tag
-
(Required) The filter tag to remove filters from.
- $priority
-
(Optional) If present, only those callbacks attached at a given priority will be removed. Otherwise, all callbacks attached to the tag will be removed, regardless of priority.
Default value: false
Return
(bool) True on success.
Source
File: bp-core/bp-core-theme-compatibility.php
733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 | function bp_remove_all_filters( $tag , $priority = false ) { global $wp_filter , $merged_filters ; $bp = buddypress(); // Filters exist. if ( isset( $wp_filter [ $tag ] ) ) { // Filters exist in this priority. if ( ! empty ( $priority ) && isset( $wp_filter [ $tag ][ $priority ] ) ) { // Store filters in a backup. $bp ->filters->wp_filter[ $tag ][ $priority ] = $wp_filter [ $tag ][ $priority ]; // Unset the filters. unset( $wp_filter [ $tag ][ $priority ] ); // Priority is empty. } else { // Store filters in a backup. $bp ->filters->wp_filter[ $tag ] = $wp_filter [ $tag ]; // Unset the filters. unset( $wp_filter [ $tag ] ); } } // Check merged filters. if ( isset( $merged_filters [ $tag ] ) ) { // Store filters in a backup. $bp ->filters->merged_filters[ $tag ] = $merged_filters [ $tag ]; // Unset the filters. unset( $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.