From 19878b885ca9b6198c1e0aed3ac5cf90ffde97f4 Mon Sep 17 00:00:00 2001 From: nikitasinelnikov Date: Wed, 12 Jun 2019 12:52:12 +0300 Subject: [PATCH] - fixed home page restriction; --- includes/core/class-access.php | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/includes/core/class-access.php b/includes/core/class-access.php index 2ad80655..b009a529 100644 --- a/includes/core/class-access.php +++ b/includes/core/class-access.php @@ -372,15 +372,22 @@ if ( ! class_exists( 'um\core\Access' ) ) { * Old global restrict content logic */ function template_redirect() { - global $post; + global $post, $wp_query; //if we logged by administrator it can access to all content if ( current_user_can( 'administrator' ) ) return; + if ( is_object( $wp_query ) ) { + $is_singular = $wp_query->is_singular(); + } else { + $is_singular = ! empty( $wp_query->is_singular ) ? true : false; + } + //if we use individual restrict content options skip this function - if ( $this->singular_page ) + if ( $is_singular && $this->singular_page ) { return; + } //also skip if we currently at wp-admin or 404 page if ( is_admin() || is_404() )