Close

Function – remove all admin notices

function ds_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’, ‘ds_disable_admin_notices’ );