From e5d5077c3f4313e6cc779772a225c4f45709c94f Mon Sep 17 00:00:00 2001 From: Nikita Sinelnikov Date: Mon, 2 Aug 2021 13:46:14 +0300 Subject: [PATCH] - fixed restrict access; --- includes/core/class-access.php | 35 +++++++++++++++++++--------------- 1 file changed, 20 insertions(+), 15 deletions(-) diff --git a/includes/core/class-access.php b/includes/core/class-access.php index efcf1c00..eec989fa 100644 --- a/includes/core/class-access.php +++ b/includes/core/class-access.php @@ -1257,22 +1257,27 @@ if ( ! class_exists( 'um\core\Access' ) ) { global $wpdb; - $this->ignore_exclude = true; - // exclude all posts assigned to current term without individual restriction settings - $post_ids = get_posts( - array( - 'fields' => 'ids', - 'post_status' => 'any', - 'numberposts' => -1, - 'meta_query' => array( - array( - 'key' => 'um_content_restriction', - 'compare' => 'EXISTS', + $restricted_posts = UM()->options()->get( 'restricted_access_post_metabox' ); + if ( ! empty( $restricted_posts ) ) { + $this->ignore_exclude = true; + // exclude all posts assigned to current term without individual restriction settings + $post_ids = get_posts( + array( + 'fields' => 'ids', + 'post_status' => 'any', + 'post_type' => array_keys( $restricted_posts ), + 'numberposts' => -1, + 'meta_query' => array( + array( + 'key' => 'um_content_restriction', + 'compare' => 'EXISTS', + ), ), - ), - ) - ); - $this->ignore_exclude = false; + ) + ); + + $this->ignore_exclude = false; + } $post_ids = empty( $post_ids ) ? array() : $post_ids;