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?

1 Answer 1


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 upon comment_status => 'open'.

  • I really appreciate your answer. Can you please post more details about this. I didn't find much tutorials and examples on this filter, but it seems it can do what i need :).
    – idjuradj
    Commented Sep 11, 2012 at 21:32

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.