General: Introduce WP_Error::has_errors() method and use it where appropriate.

Props robdxw, DrewAPicture, SergeyBiryukov.
Fixes #42742.
Built from https://develop.svn.wordpress.org/trunk@42761


git-svn-id: http://core.svn.wordpress.org/trunk@42591 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Sergey Biryukov
2018-02-27 02:31:31 +00:00
parent 71f206839d
commit 0e802a627d
21 changed files with 57 additions and 41 deletions

View File

@@ -44,7 +44,7 @@ if ( isset( $_REQUEST['action'] ) && 'add-user' == $_REQUEST['action'] ) {
$user = wp_unslash( $_POST['user'] );
$user_details = wpmu_validate_user_signup( $user['username'], $user['email'] );
if ( is_wp_error( $user_details['errors'] ) && ! empty( $user_details['errors']->errors ) ) {
if ( is_wp_error( $user_details['errors'] ) && $user_details['errors']->has_errors() ) {
$add_user_errors = $user_details['errors'];
} else {
$password = wp_generate_password( 12, false );