Created
October 24, 2019 18:32
-
-
Save tozbey/f0132bdddf152dc68fe3ff552ba9ba5c to your computer and use it in GitHub Desktop.
Hide WordPress admin 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
// Hide WordPress admin notices | |
function oz_disable_admin_notices() { | |
global $wp_filter; | |
if ( is_user_admin() ) { | |
if ( isset( $wp_filter['user_admin_notices'] ) ) { | |
unset( $wp_filter['user_admin_notices'] ); | |
} | |
} elseif ( isset( $wp_filter['admin_notices'] ) ) { | |
unset( $wp_filter['admin_notices'] ); | |
} | |
if ( isset( $wp_filter['all_admin_notices'] ) ) { | |
unset( $wp_filter['all_admin_notices'] ); | |
} | |
} | |
add_action( 'admin_print_scripts', 'oz_disable_admin_notices' ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment