diff --git a/CHANGELONG.md b/CHANGELONG.md index 618dcda..24c5ea5 100755 --- a/CHANGELONG.md +++ b/CHANGELONG.md @@ -4,6 +4,10 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](http://keepachangelog.com/) and this project adheres to [Semantic Versioning](http://semver.org/). +## 1.3.1 2019-02-06 +### Updated +- Added additional check for object on `site_transient_update_plugins` check. + ## 1.3.0.1 2018-07-30 ### Changed - Move the Admin class into an action hook on `after_setup_theme` to avoid conditional notices. diff --git a/composer.json b/composer.json index bb4432a..19b0046 100755 --- a/composer.json +++ b/composer.json @@ -2,7 +2,7 @@ "name": "dwnload/wp-rest-api-object-cache", "description": "Enable object caching for WordPress' REST API. Aids in increased response times of your applications endpoints.", "type": "wordpress-plugin", - "version": "1.3.0.1", + "version": "1.3.1", "license": "MIT", "authors": [ { diff --git a/wp-rest-api-cache.php b/wp-rest-api-cache.php index aeddac1..e4f4cab 100644 --- a/wp-rest-api-cache.php +++ b/wp-rest-api-cache.php @@ -4,7 +4,7 @@ * Description: Enable object caching for WordPress' REST API. Aids in increased response times of your applications endpoints. * Author: Austin Passy * Author URI: http://github.com/thefrosty - * Version: 1.3.0.1 + * Version: 1.3.1 * Requires at least: 4.9 * Tested up to: 4.9 * Requires PHP: 7.0 @@ -25,15 +25,10 @@ } }); -call_user_func_array( - function ($filter) { - add_filter($filter, function ($value) use ($filter) { - if (! empty($value->response) && array_key_exists(plugin_basename(__FILE__), $value->response)) { - unset($value->response[plugin_basename(__FILE__)]); - } +add_filter('site_transient_update_plugins', function ($value) { + if (isset($value) && is_object($value) && (! empty($value->response) && is_array($value->response))) { + unset($value->response[@plugin_basename(__FILE__)]); + } - return $value; - }); - }, - ['pre_site_transient_update_plugins', 'site_transient_update_plugins'] -); + return $value; +});