Table of Contents

How to remove admin notices from specific pages?

In this article, I will show how to remove WordPress admin notices from a specific page. Below the code

If theme then add code in functions.php file or If plugin then add code in plugin file

function hrm_remove_admin_notice(){
  	// First make a array with page slug
	$pages = [

		if( in_array( $_GET['page'], $pages) ){
			remove_all_actions( 'user_admin_notices' );
			remove_all_actions( 'admin_notices' );

add_action('in_admin_header', 'hrm_remove_admin_notice', 99);
Share on facebook
Share on twitter
Share on linkedin

Leave a Comment

Your email address will not be published.

Related Posts