Last active
January 14, 2023 17:17
-
-
Save shewa12/8aab3c7ee5d6c68568342be4685d6541 to your computer and use it in GitHub Desktop.
Remove annoying notices from WordPress Admin Dashboard
This file contains 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
<script> | |
/** | |
* Remove annoying notices WordPress Dashboard | |
* | |
* Place this script on which page you don't want to show | |
* notices. | |
* | |
* Note: it will remove all the notices | |
*/ | |
document.addEventListener('DOMContentLoaded', function() { | |
const isAdmin = () => { | |
return document.body.classList.contains('wp-admin'); | |
} | |
if ( isAdmin() ) { | |
document.querySelectorAll('.notice').forEach( notice => notice.remove() ); | |
} | |
}); | |
</script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment