Make WordPress Core


Ignore:
Timestamp:
02/27/2018 02:30:46 AM (6 years ago)
Author:
SergeyBiryukov
Message:

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

Props robdxw, DrewAPicture, SergeyBiryukov.
Fixes #42742.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/rest-api/endpoints/class-wp-rest-users-controller.php

    r42343 r42761  
    471471            $ret = wpmu_validate_user_signup( $user->user_login, $user->user_email );
    472472
    473             if ( is_wp_error( $ret['errors'] ) && ! empty( $ret['errors']->errors ) ) {
     473            if ( is_wp_error( $ret['errors'] ) && $ret['errors']->has_errors() ) {
    474474                $error = new WP_Error( 'rest_invalid_param', __( 'Invalid user parameter(s).' ), array( 'status' => 400 ) );
    475475                foreach ( $ret['errors']->errors as $code => $messages ) {
Note: See TracChangeset for help on using the changeset viewer.