i’m interested how to display all posts (from all categories) that have closed/disabled comments?
I have tried using the comments_open() function inside the loop, that works, i don’t know how to enable pagination on it, and here’s why:
wp query – here’s the query that displays all posts, i set here how many per page should be displayed
if (!comments are open) i list the posts
so, the problem here is that i want to show 10 posts per page -the loop actually goes through 10 posts, and displays any post of the given 10 that has closed comments, and then creates a second page with 10 posts and does the same etc…
I need a filter inside the loop itself, so i display 10 posts with disabled comments PER PAGE.
Pls, can anyone help with this?
I don’t have the time right now to work the code, but you’ll need to use
pre_get_posts
and filter out based uponcomment_status => 'open'
.