‘Load More Posts’ still visible when posts < 10.
-
I’ve noticed that the ‘Load More Posts’ button is always visible, even when the post count is less than 10.
I’ve investigated the issue and found that the class-user-posts.php file is using wp_count_posts() which doesn’t seem appropriate. I believe this returns all posts from all users? Hence, the number will always be > 10.
I would be replacing:-
$count_posts = wp_count_posts(); $count_posts = ! empty( $count_posts->publish ) ? $count_posts->publish : 0;
with:-
$count_posts = count( $posts );
This will return the correct number of posts specific to the user. And the published status has already been applied in the $args returning the $posts.
Am I missing something here?
The page I need help with: [log in to see the link]
- The topic ‘‘Load More Posts’ still visible when posts < 10.’ is closed to new replies.