bbp_remove_all_filters( string $tag, int $priority = false )
Removes all filters from a WordPress filter, and stashes them in the $bbp global in the event they need to be restored later.
Description
Parameters
- $tag
-
(Required)
- $priority
-
(Optional)
Default value: false
Return
(bool)
Source
File: bp-forums/core/theme-compat.php
884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 | function bbp_remove_all_filters( $tag , $priority = false ) { global $wp_filter , $merged_filters ; $bbp = bbpress(); // 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 $bbp ->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 $bbp ->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 $bbp ->filters->merged_filters[ $tag ] = $merged_filters [ $tag ]; // Unset the filters unset( $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.