dmchale / disable-json-api

Public repo for the "Disable REST API" WordPress plugin, currently with 90,000+ active installs in the wordpress.org repository
10 stars 9 forks source link

$access->add issue #22

Closed dmchale closed 7 years ago

dmchale commented 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.

dmchale commented 7 years ago

I will probably look at this tonight/tomorrow, but wanted to document it here for now

dmchale commented 7 years ago

Fixed : https://github.com/dmchale/disable-json-api/commit/06dcfff6cae167999298b27745078d1eec7355bc