bp_restore_all_filters( string $tag, int|bool $priority = false )

Restore filters that were removed using bp_remove_all_filters().


Description Description


Parameters 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


Top ↑

Return Return

(bool) True on success.


Top ↑

Source 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;
}

Top ↑

Changelog Changelog

Changelog
Version Description
1.7.0 Introduced.

Top ↑

User Contributed Notes User Contributed Notes

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