• Resolved marcusraket.nu

    (@marcusraketnu)


    Hi,
    There’s a bug in get_wp_error on line 209 where you return $access->add.
    WP_Error::add doesn’t actually return the WP_Error instance so you end up returning NULL instead of WP_Error.
    Simply write:

    
    $access->add( 'rest_cannot_access', $error_message, array( 'status' => rest_authorization_required_code() ) );
    return $access;
    

    to fix this.

Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Bug in get_wp_error’ is closed to new replies.