From 0f637daef87862cbcf52ab65a835ebb8fc42737a Mon Sep 17 00:00:00 2001 From: Alan Pinstein Date: Thu, 24 Jan 2019 10:01:43 -0500 Subject: [PATCH] Fixes #11 - plugin exits when run from cli script. --- force/redirect.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/force/redirect.php b/force/redirect.php index 8a237dd..32f430a 100644 --- a/force/redirect.php +++ b/force/redirect.php @@ -20,6 +20,10 @@ final class Redirect extends Helpers\Singleton { * Initialize the redirection process */ protected function onConstruct() { + if (php_sapi_name() == "cli") { + // do nothing when we are in CLI mode + return; + } add_action('init', [$this, 'init'], PHP_INT_MAX); } @@ -90,4 +94,4 @@ private function removeHeaders() { -} \ No newline at end of file +}