Php 为什么不能更新WordPress用户?

Php 为什么不能更新WordPress用户?,php,wordpress,user-input,Php,Wordpress,User Input,我正在创建一个模板,用户可以在其中更新其详细信息 /* Load the registration file. */ require_once( ABSPATH . WPINC . '/registration.php' ); //deprecated since 3.1 $error = array(); /* If profile was saved, update profile. */ if ( 'POST' == $_SERVER['REQUEST_METHOD']

我正在创建一个模板,用户可以在其中更新其详细信息

 /* Load the registration file. */
 require_once( ABSPATH . WPINC . '/registration.php' ); //deprecated since 
 3.1
$error = array();    
 /* If profile was saved, update profile. */
if ( 'POST' == $_SERVER['REQUEST_METHOD'] && !empty( $_POST['action'] ) && 
$_POST['action'] == 'update-user' ) {

  /* Update user password. */
if ( !empty($_POST['pass1'] ) && !empty( $_POST['pass2'] ) ) {
    if ( $_POST['pass1'] == $_POST['pass2'] )
        wp_update_user( array( 'ID' => $current_user->ID, 'user_pass' => esc_attr( $_POST['pass1'] ) ) );
    else
        $error[] = __('The passwords you entered do not match.  Your password was not updated.', 'profile');
}

/* Update user information. */
if ( !empty( $_POST['url'] ) )
    wp_update_user( array( 'ID' => $current_user->ID, 'user_url' => esc_url( $_POST['url'] ) ) );
if ( !empty( $_POST['email'] ) ){
    if (!is_email(esc_attr( $_POST['email'] )))
        $error[] = __('The Email you entered is not valid.  please try again.', 'profile');
    elseif(email_exists(esc_attr( $_POST['email'] )) != $current_user->id )
        $error[] = __('This email is already used by another user.  try a different one.', 'profile');
    else{
        wp_update_user( array ('ID' => $current_user->ID, 'user_email' => esc_attr( $_POST['email'] )));
    }
}

if ( !empty( $_POST['first-name'] ) )
    update_user_meta( $current_user->ID, 'first_name', esc_attr( $_POST['first-name'] ) );
if ( !empty( $_POST['last-name'] ) )
    update_user_meta($current_user->ID, 'last_name', esc_attr( $_POST['last-name'] ) );
if ( !empty( $_POST['description'] ) )
    update_user_meta( $current_user->ID, 'description', esc_attr( $_POST['description'] ) );


if ( count($error) == 0 ) {
    //action hook for plugins and extra fields saving
    do_action('edit_user_profile_update', $current_user->ID);
    wp_redirect('http://localhost:81/DEMO/profile/' );
    exit;
}
}
  ?>
按update后,数据会更改,但我收到以下警告:

警告:无法修改标题信息-标题已由C:\xamp\htdocs\DEMO\wp includes\general template.php:2768中的C:\xamp\htdocs\DEMO\wp includes\pluggable.php第1216行发送(输出开始于C:\xamp\htdocs\DEMO\wp includes\general template.php:2768)


原因可能是什么

将此代码添加到wp-config.php的第一行:

ob_start();
error_reporting(0);

(此错误)通常是因为在打开
标记之前有空格、新行或其他内容,通常在wp config.php中,在wp-config.php的第一行添加此代码:

ob_start();
error_reporting(0);
(此错误)通常是因为在开始标记之前有空格、新行或其他内容,通常在wp config.php中