验证新用户注册

原型

validate_user_signup()

返回值

(bool)  如果验证了新用户注册,则为true;如果错误,则为false

源文件

路径:wp-signup.php

<?php
...
function validate_user_signup() {
	$result = validate_user_form();
	$user_name = $result['user_name'];
	$user_email = $result['user_email'];
	$errors = $result['errors'];
	if ( $errors->get_error_code() ) {
		signup_user($user_name, $user_email, $errors);
		return false;
	}
	if ( 'blog' == $_POST['signup_for'] ) {
		signup_blog($user_name, $user_email);
		return false;
	}
	/** This filter is documented in wp-signup.php */
	wpmu_signup_user( $user_name, $user_email, apply_filters( 'add_signup_meta', array() ) );
	confirm_user_signup($user_name, $user_email);
	return true;
}
...
?>

其他

英文文档:https://developer.wordpress.org/reference/functions/validate_user_signup/