From 58bbd3cede6d8a83290994b7feed68a5c1ecc5ff Mon Sep 17 00:00:00 2001 From: Nikita Sinelnikov Date: Mon, 23 Aug 2021 17:21:30 +0300 Subject: [PATCH] - fixed notices if there aren't restricted post types; --- includes/core/class-access.php | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/includes/core/class-access.php b/includes/core/class-access.php index 5073d5bb..5a7c440d 100644 --- a/includes/core/class-access.php +++ b/includes/core/class-access.php @@ -166,9 +166,11 @@ if ( ! class_exists( 'um\core\Access' ) ) { } } else { $restricted_posts = UM()->options()->get( 'restricted_access_post_metabox' ); - $restricted_posts = array_keys( $restricted_posts ); - if ( ! empty( $post_types ) ) { - $restricted_posts = array_intersect( $post_types, $restricted_posts ); + if ( ! empty( $restricted_posts ) ) { + $restricted_posts = array_keys( $restricted_posts ); + if ( ! empty( $post_types ) ) { + $restricted_posts = array_intersect( $post_types, $restricted_posts ); + } } if ( ! empty( $restricted_posts ) ) { @@ -812,6 +814,9 @@ if ( ! class_exists( 'um\core\Access' ) ) { global $wp_taxonomies; $restricted_posts = UM()->options()->get( 'restricted_access_post_metabox' ); + if ( empty( $restricted_posts ) ) { + $restricted_posts = array(); + } $restricted_posts = array_keys( $restricted_posts ); $restricted_taxonomies = UM()->options()->get( 'restricted_access_taxonomy_metabox' );