diff --git a/includes/core/class-access.php b/includes/core/class-access.php index f29797b5..b9819cdc 100644 --- a/includes/core/class-access.php +++ b/includes/core/class-access.php @@ -1432,7 +1432,7 @@ if ( ! class_exists( 'um\core\Access' ) ) { * @param \WP_Query $query */ function exclude_posts( $query ) { - if ( $query->is_main_query() ) { + if ( $query->is_main_query() || ! empty( $query->query_vars['um_main_query'] ) ) { $force = is_search() || is_admin(); $exclude_posts = $this->exclude_posts_array( $force ); if ( ! empty( $exclude_posts ) ) { diff --git a/includes/core/class-user-posts.php b/includes/core/class-user-posts.php index 33fb2374..afd50a03 100644 --- a/includes/core/class-user-posts.php +++ b/includes/core/class-user-posts.php @@ -29,11 +29,12 @@ if ( ! class_exists( 'um\core\User_posts' ) ) { */ function add_posts() { $args = array( - 'post_type' => 'post', - 'posts_per_page' => 10, - 'offset' => 0, - 'author' => um_get_requested_user(), - 'post_status' => array( 'publish' ) + 'post_type' => 'post', + 'posts_per_page' => 10, + 'offset' => 0, + 'author' => um_get_requested_user(), + 'post_status' => array( 'publish' ), + 'um_main_query' => true, ); /** @@ -107,11 +108,12 @@ if ( ! class_exists( 'um\core\User_posts' ) ) { $page = ! empty( $_POST['page'] ) ? absint( $_POST['page'] ) : 0; $args = array( - 'post_type' => 'post', - 'posts_per_page' => 10, - 'offset' => ( $page - 1 ) * 10, - 'author' => $author, - 'post_status' => array( 'publish' ) + 'post_type' => 'post', + 'posts_per_page' => 10, + 'offset' => ( $page - 1 ) * 10, + 'author' => $author, + 'post_status' => array( 'publish' ), + 'um_main_query' => true, ); /**