Closed dmchale closed 7 years ago
Reported here: https://wordpress.org/support/topic/bug-in-get_wp_error/
Copypasta:
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.
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.
I will probably look at this tonight/tomorrow, but wanted to document it here for now
Fixed : https://github.com/dmchale/disable-json-api/commit/06dcfff6cae167999298b27745078d1eec7355bc
Reported here: https://wordpress.org/support/topic/bug-in-get_wp_error/
Copypasta: