-
-
Save mmarj/3852da9f999537376540350f59d78157 to your computer and use it in GitHub Desktop.
hide admin notices in WordPress.
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
| add_action('admin_enqueue_scripts', 'ds_admin_theme_style'); | |
| add_action('login_enqueue_scripts', 'ds_admin_theme_style'); | |
| function ds_admin_theme_style() { | |
| if (!current_user_can( 'manage_options' )) { | |
| echo '<style>.update-nag, .updated, .error, .is-dismissible { display: none; }</style>'; | |
| } | |
| } | |
| /* Hide wp-admin side notice with CSS */ | |
| add_action('admin_head', 'custom_css_on_admin_dashboard'); | |
| function custom_css_on_admin_dashboard() { | |
| echo '<style> | |
| .notice, .dokan-license-notice, .update-nag, .updated, .error, .is-dismissible, .elementor-message { | |
| display: none !important; | |
| } | |
| </style>'; | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment