Try to use this function:
get_post('comment_status ->open')
checkout the codex:https://developer.wordpress.org/reference/functions/get_post/
Related Posts:
- How to make comments work for a post loaded per Ajax?
- Allow variable amount of comments before pagination
- get comments and get posts in loop
- How to display comments and comment form on custom post type?
- Comments are assigned to wrong or related post
- How can I allow editors to leave comments on posts that have not yet been published?
- Update post date on every new comment?
- One comment per user email per post
- Can’t show comments count per post outside loop
- Only display posts with comments
- Comments enabled, but disabled at the same time
- Comments not showing in custom post type – WordPress
- How to output comments number of a post per day?
- Enable commenting on front-end preview page for pending posts
- Hide comments awaiting moderation from user who submitted the comments
- Hide Post comments when displayed via WP_Query
- Including new Javascript only after a comment is made
- Disable Post/Page comment emails for creators
- Display posts with comments closed, with pagination?
- Why is WordPress redirecting users to random posts after commenting?
- How to get most recent commented post above new submitted post in WordPress?
- When trashing a post, also trash related comments
- how to find user ids of all commenters in a post
- Diplay comment date on WP_Post_Comments_List_Table
- Posts vs. Pages
- count the total number of comments the user has received for his published posts
- How to Orderby Comments by post title?
- If modified on same day, show only time
- How to allow logged in users to post anonymously
- Email entire post contents
- Query get post,how to add comment box
- Update all comments time to random dates?
- Enable Comments Box On Custom Post Type
- Turn On Comments On Custom Post Types in Directory Theme
- Emojis replaced by ‘?’ automatically
- Move comments only from one WP installation to another
- Second comments section for one post/page
- A friend wants to make a comment on one of my articles, she has to be logged to wordpress?
- Get all images in post and comments like Twitter before post title
- Is it possible to paste a link without tags and make it directly a link in a post?
- Showing author page if user has no post
- Customizing Comments on Posts
- WordPress Comment posting problem
- What do comments with […] mean?
- What do these phpMyAdmin errors mean on my WordPress databaes?
- Internal post link creates comments on its own
- How to get posts and comments amount per hour, per year and per month?
- Show comment number per author per day
- Get all comments of author’s posts
- SQL Command for restoring trashed comments
- Howto show comment count by post in post?
- How do you change the comment count in the back end posts list, to reflect unapproved comments, rather than all comments?
- Hide comments and posts posted by other user
- Let both the admin and post author update comment meta
- How to style archive post titles… but only those posts who have comments?
- Is it advisable to use $post->comment_count instead of get_comments_number( $post_id )
- How does WP decide how to display a page
- Display on page every post in blog WITH comments
- Showing recent post of category in page
- Can WordPress handle following functionalities?
- If post exists, make it a comment in existing post with same name?
- How to get post id of last approved comment?
- How to implement a WordPress comments function?
- Allow / show post comments in category pages
- Count the total views of all user posts published
- how to show comments only author which send own posts in wordpress
- Shortcode for Comments and Comment Boxes in Post Loop
- Merge get_comments & get_posts into a single query
- Remove the URL author of post on all comments
- WordPress weird behaviour on comments
- Comments are in database, don’t show up in WordPress backend or frontend
- No comments allowed
- I want to change the WordPress comments file
- Posting a comment redirects admin/users to blank page
- How to enable comments meta box for other author posts?
- Comments as part of a post
- Some comment box wordpress in 1 post [closed]
- No comments on static front page
- 3rd Party Login in wordpress
- Trash a post, send associated comments into the trash bin (change status)
- Apply comment to different post (not the current post) [duplicate]
- How can I get a comment ID on Submit?
- External link not showing on post but showing on comment
- Get first comment link on the post itself
- Get url/link to latest comments in a post
- Display only posts with comments
- wp_query select if have comments
- Display the first post’s comments of category in comments.php template
- 2 tick boxes appearing below comments
- How to display a certain template element only for posts published within certain time range?
- Admin moderates ALL comments (including post author)
- How can I show the positive and negative comments for a same post separately?
- How does WordPress add the comments and comment form to posts
- How to update wp_posts with just the returned comment count from wp_comments (SQL GROUP BY)
- Simple shortcode to check if a user has commented on a certain post
- Undefined Function Fatal Error with Shortcode [closed]
- Best method for comment section associated with different images?
- Undefined variable post_id in custom quick edit coloumn
- Exclude posts with empty post_content in wp_query
- How to populate a select field with post titles/ids in a block