From f14f0e48b1cdf4e42726342b83b372944991513d Mon Sep 17 00:00:00 2001 From: Esa-Matti Suuronen Date: Mon, 27 Jan 2020 19:03:43 +0200 Subject: [PATCH] Fix wp-graphql activation check --- src/Loader.php | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/Loader.php b/src/Loader.php index 9c0eceb..ae3232a 100644 --- a/src/Loader.php +++ b/src/Loader.php @@ -8,11 +8,6 @@ class Loader private $pll_context_called = false; static function init() { - // Bail out early if WPGraphQL is not activated. - if (!class_exists('WPGraphQL')) { - return; - }; - define('WPGRAPHQL_POLYLANG', true); (new Loader())->bind_hooks(); } @@ -102,6 +97,11 @@ function endsWith($haystack, $needle) function is_graphql_request() { + // Detect WPGraphQL activation by checking if the main class is defined + if (!class_exists('WPGraphQL')) { + return false; + }; + if (!defined('POLYLANG_VERSION')) { return false; }