diff --git a/src/class-convertkit-resource-v4.php b/src/class-convertkit-resource-v4.php index f3caf08..60f9da0 100644 --- a/src/class-convertkit-resource-v4.php +++ b/src/class-convertkit-resource-v4.php @@ -116,14 +116,12 @@ public function init() { // a last query time. This handles upgrades from < 1.9.7.4 where resources // would never expire. if ( ! $this->last_queried ) { - $this->refresh(); - return; + return $this->refresh(); } // If the resources have expired, refresh them now. if ( time() > ( $this->last_queried + $this->cache_duration ) ) { - $this->refresh(); - return; + return $this->refresh(); } } @@ -344,13 +342,13 @@ public function exist() { * * @since 1.0.0 * - * @return bool|WP_Error|array + * @return WP_Error|array */ public function refresh() { // Bail if no API class was defined. if ( ! $this->api ) { - return false; + return new WP_Error( 'convertkit_resource_refresh_error', 'Connect the Plugin to your Kit account to refresh resources.' ); } // Fetch resources.