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

936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
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

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.