Family Encyclopedia >> Electronics

How to Add Custom Warning Notices in WordPress Admin for Client Sites

As a seasoned WordPress consultant, developer, or designer, you've likely faced the challenge of handing off a project to clients. Many developers lock down the admin area to prevent accidental breakage, but this frustrates future maintainers or clients wanting more control. WordPress thrives on empowering users to manage their sites freely.

In this guide, drawn from years of hands-on experience building client sites, we'll show you how to grant full administrative access while displaying clear warning notices. Using the admin_notices hook, you can alert users to potential risks—like "Warning: Changing settings on this page may cause issues with your custom website design."

How to Add Custom Warning Notices in WordPress Admin for Client Sites

To implement this, open your theme's functions.php file and add the following code:

add_action('admin_notices', 'my_admin_notice');
function my_admin_notice() {
    global $current_screen;
    if ($current_screen->parent_base == 'options-general') {
        echo '<div class="notice notice-warning is-dismissible"><p><strong>Warning:</strong> Changing settings on this page may cause issues with your website design.</p></div>';
    }
}

Customize the message, styling, or conditions for specific screens (e.g., themes, plugins) to fit your needs. This approach balances freedom and caution effectively.

Thanks to Jacob Goldman for sharing this invaluable tip—it's a game-changer for client handovers.