Skip to content

Instantly share code, notes, and snippets.

@jamigibbs
Last active July 30, 2016 01:46
Show Gist options
  • Save jamigibbs/8776e839ce0d9edd685f2100a20b1769 to your computer and use it in GitHub Desktop.
Save jamigibbs/8776e839ce0d9edd685f2100a20b1769 to your computer and use it in GitHub Desktop.
Remove Redux Notices
<?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');
@jamigibbs
Copy link
Author

@Ebrahim6
Copy link

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!

@jamigibbs
Copy link
Author

@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