From 0f443ba8ccc3a1da7ba233dd29dc4a24ddf515e6 Mon Sep 17 00:00:00 2001 From: Micah Wood Date: Mon, 13 Nov 2023 14:34:26 -0500 Subject: [PATCH] =?UTF-8?q?Fix=20the=20issue=20where=20error=20responses?= =?UTF-8?q?=20were=20stored=20as=20the=20capabilities=20array=E2=80=94chec?= =?UTF-8?q?ks=20for=20200=20status.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- includes/SiteCapabilities.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/includes/SiteCapabilities.php b/includes/SiteCapabilities.php index c72204a..95c39a9 100644 --- a/includes/SiteCapabilities.php +++ b/includes/SiteCapabilities.php @@ -29,7 +29,7 @@ public function all() { /** * Check if a capability exists. * - * @param string $capability Capability name. + * @param string $capability Capability name. * * @return bool */ @@ -40,7 +40,7 @@ public function exists( $capability ) { /** * Get the value of a capability. * - * @param string $capability Capability name. + * @param string $capability Capability name. * * @return bool */ @@ -67,7 +67,7 @@ public function fetch() { ) ); - if ( ! is_wp_error( $response ) ) { + if ( wp_remote_retrieve_response_code( $response ) === 200 && ! is_wp_error( $response ) ) { $body = wp_remote_retrieve_body( $response ); $data = json_decode( $body, true ); if ( $data && is_array( $data ) ) {