bbp_restore_all_filters( string $tag, int $priority = false )

Restores filters from the $bbp global that were removed using bbp_remove_all_filters()


Description Description


Parameters Parameters

$tag

(Required)

$priority

(Optional)

Default value: false


Top ↑

Return Return

(bool)


Top ↑

Source Source

File: includes/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;
}

Top ↑

Changelog Changelog

Changelog
Version Description
2.0.0 Introduced.

Top ↑

User Contributed Notes User Contributed Notes

You must log in before being able to contribute a note or feedback.