if(!empty($_POST['checkpassword'])){
$check = wp_check_password($_POST['checkpassword'], $user->user_pass, $user->ID );
if ( $check && isset($sanitized_values['password2']) ){
$user_data['password'] = $sanitized_values['password2'];
unset( $sanitized_values['password2'] );
} else {
return $cmb->prop( 'submission_error', new WP_Error( 'post_data_missing', __( '我们检测到您输入了错误的密码,此页面未发生更改!' ) ) );
}
}
直接用$_POST
就好啊,没看见这个自定义字段的id是password2,所以根本没有被保存到 $sanitized_values