From fc42ffa347975321c5722de5da40cda0c35aa394 Mon Sep 17 00:00:00 2001 From: Jordan Doyle Date: Tue, 6 Dec 2016 23:50:23 +0000 Subject: [PATCH] Take advantage of plugin.php being loaded using require_once in WP 3.7 --- src/Support/Action.php | 12 +----------- 1 file changed, 1 insertion(+), 11 deletions(-) diff --git a/src/Support/Action.php b/src/Support/Action.php index 8bd93a6..7e8514e 100644 --- a/src/Support/Action.php +++ b/src/Support/Action.php @@ -19,17 +19,7 @@ class Action public static function hook($tag, $function, $priority = 10, $acceptedArgs = 1) { if (!function_exists('add_filter')) { - // we need to register this hook before wp-settings.php is included, which also means - // that add_filter hasn't been included yet so we have to add to the wp_filter global - // manually. - $GLOBALS['wp_filter'][$tag][$priority][] = [ - 'function' => function (...$args) use ($function) { - return app()->call($function, $args); - }, - 'accepted_args' => $acceptedArgs, - ]; - - return; + require_once ABSPATH . '/wp-includes/plugin.php'; } add_filter($tag, function (...$args) use ($function) { -- libgit2 1.7.2