- fixed posts query in the User Profile;

This commit is contained in:
Nikita Sinelnikov
2021-08-12 15:57:21 +03:00
parent 15ee898905
commit c8a09caef4
2 changed files with 13 additions and 11 deletions
+1 -1
View File
@@ -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 ) ) {
+12 -10
View File
@@ -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,
);
/**