Skip to content

Instantly share code, notes, and snippets.

@fandasson
fandasson / wp-remove-admin-notices.php
Created February 21, 2018 12:08
Hides All Notices in WordPress Admin Pages from all users except admins
/**
You may use current_user_can('administrator') instead of is_super_admin() for not MU sites
DO NOT use is_admin() since it doesn't check users role nor capability
Be aware this hides also notifications thant a content (page/post/...) was saved
*/
function remove_admin_notices() {
if(!is_super_admin()){
remove_all_actions( 'admin_notices' );
echo "<style>.wp-admin .notice {display:none !important;}</style>";