From 63fa0be833b3612b0e471f594584a846e3627405 Mon Sep 17 00:00:00 2001 From: Erick Hitter <git-contrib@ethitter.com> Date: Sun, 18 Feb 2018 18:02:27 -0800 Subject: [PATCH] Don't rewrite if we aren't ready --- camo-image-proxy.php | 5 +++-- inc/class-url.php | 5 +++++ 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/camo-image-proxy.php b/camo-image-proxy.php index 8ea8e5b..2403a19 100755 --- a/camo-image-proxy.php +++ b/camo-image-proxy.php @@ -58,10 +58,11 @@ function init() { Options::instance(); URL::instance(); - // Don't rewrite in the admin! if ( is_admin() ) { Options_Page::instance(); - } else { + } + + if ( URL::instance()->can_rewrite() ) { Rewrite_URLs::instance(); Rewrite_Content::instance(); } diff --git a/inc/class-url.php b/inc/class-url.php index dc2475e..33b4496 100644 --- a/inc/class-url.php +++ b/inc/class-url.php @@ -19,6 +19,11 @@ class URL { * @return bool */ public function can_rewrite() : bool { + // Never rewrite in admin. + if ( is_admin() ) { + return false; + } + $host = Options::instance()->get( 'host' ); $key = Options::instance()->get( 'key' ); -- GitLab