Skip to content

Commit 107dc53

Browse files
committed
Move the Admin class into an action hook on after_setup_theme to avoid conditional notices.
1 parent c0aedf5 commit 107dc53

File tree

2 files changed

+7
-6
lines changed

2 files changed

+7
-6
lines changed

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",
5+
"version": "1.3.0.1",
66
"license": "MIT",
77
"authors": [
88
{

wp-rest-api-cache.php

Lines changed: 6 additions & 5 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
7+
* Version: 1.3.0.1
88
* Requires at least: 4.9
99
* Tested up to: 4.9
1010
* Requires PHP: 7.0
@@ -19,10 +19,11 @@
1919

2020
$plugin = PluginFactory::create('rest-api-object-cache');
2121
$plugin->addOnHook(RestDispatch::class, 'rest_api_init')->initialize();
22-
23-
if (is_admin()) {
24-
$plugin->add(new Admin())->initialize();
25-
}
22+
add_action('after_setup_theme', function () use ($plugin) {
23+
if (is_admin()) {
24+
$plugin->add(new Admin())->initialize();
25+
}
26+
});
2627

2728
call_user_func_array(
2829
function ($filter) {

0 commit comments

Comments
 (0)