From 3c0e4d458de1458a0239b9532958b497912c3f5c Mon Sep 17 00:00:00 2001 From: Nikita Sinelnikov Date: Fri, 6 Aug 2021 14:52:50 +0300 Subject: [PATCH] - fixed search query and restricted posts. Avoid parsing posts via the search query --- includes/core/class-access.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/includes/core/class-access.php b/includes/core/class-access.php index 2b265a57..2108de7d 100644 --- a/includes/core/class-access.php +++ b/includes/core/class-access.php @@ -1423,7 +1423,8 @@ if ( ! class_exists( 'um\core\Access' ) ) { */ function exclude_posts( $query ) { if ( $query->is_main_query() ) { - $exclude_posts = $this->exclude_posts_array( is_admin() ); + $force = is_search() || is_admin(); + $exclude_posts = $this->exclude_posts_array( $force ); if ( ! empty( $exclude_posts ) ) { $post__not_in = $query->get( 'post__not_in', array() ); $query->set( 'post__not_in', array_merge( wp_parse_id_list( $post__not_in ), $exclude_posts ) );