Last active
July 30, 2016 01:46
-
-
Save jamigibbs/8776e839ce0d9edd685f2100a20b1769 to your computer and use it in GitHub Desktop.
Remove Redux Notices
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
if ( ! function_exists( 'theme_name_remove_anonymous_object_filter' ) ){ | |
/** | |
* Remove an anonymous object filter. | |
* | |
* @param string $tag Hook name. | |
* @param string $class Class name | |
* @param string $method Method name | |
* @return void | |
*/ | |
function theme_name_remove_anonymous_object_filter( $tag, $class, $method ) { | |
$filters = $GLOBALS['wp_filter'][ $tag ]; | |
if ( empty ( $filters ) ) { | |
return; | |
} | |
foreach ( $filters as $priority => $filter ) { | |
foreach ( $filter as $identifier => $function ) { | |
if ( is_array( $function) | |
and is_a( $function['function'][0], $class ) | |
and $method === $function['function'][1] ) { | |
remove_filter( | |
$tag, | |
array ( $function['function'][0], $method ), | |
$priority | |
); | |
} | |
} | |
} | |
} | |
} | |
function theme_name_remove_redux_framework_admin_notices_action() { | |
theme_name_remove_anonymous_object_filter( | |
'admin_notices', | |
'ReduxFramework', | |
'_admin_notices' | |
); | |
} | |
add_action('admin_init', 'theme_name_remove_redux_framework_admin_notices_action'); |
Thanks for the code! I do not know if this code really works! Did you test it? I got soft rejection 2 times for this. Lets see if it works!
@Ebrahim6 I've tested it, yes. It doesn't remove any advertisements in the theme options panel though. Additional solutions: https://gist.github.com/jamigibbs/3ffe6a77fbecaaa88d34f2d551e9dd8f
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Reference: http://wordpress.stackexchange.com/questions/57079/how-to-remove-a-filter-that-is-an-anonymous-object