Skip to content

Commit

Permalink
Move the Admin class into an action hook on after_setup_theme to av…
Browse files Browse the repository at this point in the history
…oid conditional notices.
  • Loading branch information
thefrosty committed Jul 30, 2018
1 parent c0aedf5 commit 107dc53
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
"version": "1.3.0.1",
"license": "MIT",
"authors": [
{
Expand Down
11 changes: 6 additions & 5 deletions wp-rest-api-cache.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
* Version: 1.3.0.1
* Requires at least: 4.9
* Tested up to: 4.9
* Requires PHP: 7.0
Expand All @@ -19,10 +19,11 @@

$plugin = PluginFactory::create('rest-api-object-cache');
$plugin->addOnHook(RestDispatch::class, 'rest_api_init')->initialize();

if (is_admin()) {
$plugin->add(new Admin())->initialize();
}
add_action('after_setup_theme', function () use ($plugin) {
if (is_admin()) {
$plugin->add(new Admin())->initialize();
}
});

call_user_func_array(
function ($filter) {
Expand Down

0 comments on commit 107dc53

Please sign in to comment.