Skip to content

Commit 4cd0908

Browse files
committed
Update WordPress plugin check filter with additional object check.
1 parent 5b90593 commit 4cd0908

File tree

3 files changed

+12
-13
lines changed

3 files changed

+12
-13
lines changed

CHANGELONG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,10 @@ All notable changes to this project will be documented in this file.
44
The format is based on [Keep a Changelog](http://keepachangelog.com/)
55
and this project adheres to [Semantic Versioning](http://semver.org/).
66

7+
## 1.3.1 2019-02-06
8+
### Updated
9+
- Added additional check for object on `site_transient_update_plugins` check.
10+
711
## 1.3.0.1 2018-07-30
812
### Changed
913
- Move the Admin class into an action hook on `after_setup_theme` to avoid conditional notices.

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"name": "dwnload/wp-rest-api-object-cache",
33
"description": "Enable object caching for WordPress' REST API. Aids in increased response times of your applications endpoints.",
44
"type": "wordpress-plugin",
5-
"version": "1.3.0.1",
5+
"version": "1.3.1",
66
"license": "MIT",
77
"authors": [
88
{

wp-rest-api-cache.php

Lines changed: 7 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
* Description: Enable object caching for WordPress' REST API. Aids in increased response times of your applications endpoints.
55
* Author: Austin Passy
66
* Author URI: http://github.com/thefrosty
7-
* Version: 1.3.0.1
7+
* Version: 1.3.1
88
* Requires at least: 4.9
99
* Tested up to: 4.9
1010
* Requires PHP: 7.0
@@ -25,15 +25,10 @@
2525
}
2626
});
2727

28-
call_user_func_array(
29-
function ($filter) {
30-
add_filter($filter, function ($value) use ($filter) {
31-
if (! empty($value->response) && array_key_exists(plugin_basename(__FILE__), $value->response)) {
32-
unset($value->response[plugin_basename(__FILE__)]);
33-
}
28+
add_filter('site_transient_update_plugins', function ($value) {
29+
if (isset($value) && is_object($value) && (! empty($value->response) && is_array($value->response))) {
30+
unset($value->response[@plugin_basename(__FILE__)]);
31+
}
3432

35-
return $value;
36-
});
37-
},
38-
['pre_site_transient_update_plugins', 'site_transient_update_plugins']
39-
);
33+
return $value;
34+
});

0 commit comments

Comments
 (0)