返回介绍

update_option_new_admin_email()

发布于 2017-09-11 11:05:15 字数 3431 浏览 1005 评论 0 收藏 0

update_option_new_admin_email( string $old_value,  string $value )

Sends an email when a site administrator email address is changed.


description


参数

$old_value

(string) (Required) The old email address. Not currently used.

$value

(string) (Required) The new email address.


源代码

File: wp-admin/includes/ms.php

function update_option_new_admin_email( $old_value, $value ) {
	if ( $value == get_option( 'admin_email' ) || !is_email( $value ) )
		return;

	$hash = md5( $value. time() .mt_rand() );
	$new_admin_email = array(
		'hash' => $hash,
		'newemail' => $value
	);
	update_option( 'adminhash', $new_admin_email );

	$switched_locale = switch_to_locale( get_user_locale() );

	/* translators: Do not translate USERNAME, ADMIN_URL, EMAIL, SITENAME, SITEURL: those are placeholders. */
	$email_text = __( 'Howdy

更新日志

Versiondescription
3.0.0Introduced.

相关函数

Uses

  • wp-includes/l10n.php: restore_previous_locale()
  • wp-includes/l10n.php: switch_to_locale()
  • wp-includes/l10n.php: get_user_locale()
  • wp-admin/includes/ms.php: new_admin_email_content
  • wp-includes/l10n.php: __()
  • wp-includes/formatting.php: esc_url()
  • wp-includes/formatting.php: is_email()
  • wp-includes/formatting.php: wp_specialchars_decode()
  • wp-includes/pluggable.php: wp_get_current_user()
  • wp-includes/pluggable.php: wp_mail()
  • wp-includes/link-template.php: self_admin_url()
  • wp-includes/link-template.php: network_home_url()
  • wp-includes/plugin.php: apply_filters()
  • wp-includes/option.php: get_site_option()
  • wp-includes/option.php: update_option()
  • wp-includes/option.php: get_option()
  • Show 11 more uses Hide more uses

User Contributed Notes

  1. Skip to note content You must log in to vote on the helpfulness of this noteVote results for this note: 0You must log in to vote on the helpfulness of this note Contributed by Codex

    Disable the confirmation notices when an administrator changes their email address.

    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 );
    

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
    我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
    原文