ap_remove_all_filters( string $tag, int $priority = false )
Description #
Removes all filters from a WordPress filter, and stashes them in the anspress() global in the event they need to be restored later.
Copied directly from bbPress plugin.
Parameters #
- $tagstring (Required) Hook name.
- $priorityint (Optional) Hook priority. Default value: false
Source #
File: includes/functions.php
function ap_remove_all_filters( $tag, $priority = false ) { global $wp_filter, $merged_filters; $ap = anspress(); if ( ! is_object( $ap->new_filters ) ) { $ap->new_filters = new stdClass(); } // 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. $ap->new_filters->wp_filter[ $tag ][ $priority ] = $wp_filter[ $tag ][ $priority ]; // Unset the filters. unset( $wp_filter[ $tag ][ $priority ] ); } else { // Store filters in a backup. $ap->new_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. $ap->new_filters->merged_filters[ $tag ] = $merged_filters[ $tag ]; // Unset the filters. unset( $merged_filters[ $tag ] ); } return true; }
Expand full source code Collapse full source code View on GitHub: includes/functions.php:2454
Add your comment