感谢@rilwis。get_current_screen()
返回一个页面对象,我可以从中检查其id,我认为它是唯一的!
function dont_update_plugins() {
$screen = get_current_screen();
if($screen->id == "plugins"):?>
<div class="updated">
<h3><?php _e( \'Please do not update plugins!\', \'my-text-domain\' ); ?></h3>
</div>
<?php endif;
}
add_action( \'admin_notices\', \'dont_update_plugins\' );