WordPress.org

Codex

Interested in functions, hooks, classes, or methods? Check out the new WordPress Code Reference!

Function Reference/update option new admin email

Description

This function intercepts changes to the administrator's email address. It keeps the address from being updated and instead sends the user a confirmation email, with a link to confirm the change.

Usage

<?php update_option_new_admin_email$old_value$value ); ?>

Note: This function is not intended to be called directly! See below.

Parameters

$old_value
(string) (required) The administrator's old email address.
Default: None
$value
(string) (required) The new email address.
Default: None

Returns Values

This function does not return a value.

Examples

This function is hooked to the 'update_option_new_admin_email' and 'add_option_new_admin_email' actions by default. If for some reason you would like to disable it and allow administrators to change their email address without confirmation, you can do this:

<?php

remove_action( 'add_option_new_admin_email', 'update_option_new_admin_email' );
remove_action( 'update_option_new_admin_email', 'update_option_new_admin_email' );

/**
 * Disable the confirmation notices when an administrator
 * changes their email address.
 *
 * @see http://codex.wordpress.com/Function_Reference/update_option_new_admin_email
 */
function wpdocs_update_option_new_admin_email( $old_value, $value ) {

    update_option( 'admin_email', $value );
}
add_action( 'add_option_new_admin_email', 'wpdocs_update_option_new_admin_email', 10, 2 );
add_action( 'update_option_new_admin_email', 'wpdocs_update_option_new_admin_email', 10, 2 );

?>

Notes

Change Log

Since: 3.0.0

Source File

update_option_new_admin_email() is located in wp-admin/includes/ms.php.

Related

See also index of Function Reference and index of Template Tags.
This article is marked as in need of editing. You can help Codex by editing it.