Hello to all the WordPress geeks.

I want to show the list of only those posts which have comments open.

I want to send my users on a page where they can select a post to comment from the list of posts where comments are open and allowed but yet not closed. And if comments are closed it should be removed from the list.

How is that possible? Please help!


1 Answer 1


Try to use this function:

get_post('comment_status ->open')

checkout the codex:https://developer.wordpress.org/reference/functions/get_post/

  • I have checked out the codex :) and get_post() returns a single post object not a list. Also the first argument is expected to be one of int|WP_Post|null. No offense but AFAIK your code will always return null. Care to edit?
    – Michal Mau
    Feb 6, 2017 at 13:42
  • There is no function that gives you a list directly.Get the single and make your own:)
    – 吉 宁
    Feb 9, 2017 at 9:09

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.