Lock the Admin Email on Subsites
Makes the Administration Email Address field on each site's General Settings read-only for site admins, so network notices keep reaching the right person.
Opens WPIDE on
Code
if ( ! is_multisite() ) {
return;
}
add_filter( 'pre_update_option_new_admin_email', function ( $value, $old_value ) {
return is_super_admin() ? $value : get_option( 'admin_email' );
}, 10, 2 );
add_action( 'admin_footer-options-general.php', function () {
if ( is_super_admin() ) {
return;
}
?>
<script>
(function () {
var field = document.getElementById('new_admin_email');
if (field) { field.readOnly = true; field.insertAdjacentHTML('afterend', '<p class="description">Managed by the network administrator.</p>'); }
})();
</script>
<?php
} );
Notes
Super admins can still change it here or from Network Admin > Sites > Edit > Settings.
How to add this snippet
- Install WPIDE on your WordPress site (it is free) and open Code Snippets.
- Use snippet above adds it from the library in one click. Or copy the code into a new snippet with the same code type.
- It is added inactive: review the code and settings, then switch it on.