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'
.
Related Posts:
- Get all posts with empty meta_value
- How to split a post and intercalate elements from a loop
- How to remove only the latest sticky post from the loop
- Expecting statement error from php loop using ACF plugin
- Loop 3 posts column wise and continue the loop into same columns
- How I can repeat 2 HTML templates in a WordPress Query?
- PHP – Loop custom post type categories within jQuery Tabs
- Check if a post has term inside loop
- How to create a widget like this?
- How do I sort this custom list of sticky posts
- WP_Query with one category in args shows other categories
- Query only displays one page_id
- How to Order By Two Custom Fields?
- Display specific page (that is child) content on parent page
- Different Loop for tag pages?
- Ordering posts by custom field and grouped by month
- Pagination for custom loop on custom page template is not displaying anything
- Does putting queries within loops cause an issue on WordPress?
- Filtering by multiple conditions in the loop
- Hiding carousel indicators if there’s only one post
- Query Taxonomy By Page Title
- All Posts Have The Same Comments
- How to access $wp_query object from array of posts given by get_posts?
- Function using get_posts() with tax_query not working when called from functions.php
- Display all attached image of every post of custom post type and link to original post
- 2 queries with counters
- Get posts with no tags?
- wp-query, pull children of parent page
- relation OR instead of AND – Filtered term ID’s in loop
- Writing less unnecessary code with WordPress
- Does query_posts have an effect on get_the_category?
- Second loop pagination changes URL, not content
- How to change the default post type over the loop?
- I am officially missing something about transient posts
- Query Not working as expected
- Compare “Main” post ID to ID inside wp_query loop
- Offset WP_Query by negative 1
- WP_Query orderby random do not repeat infinite scroll – one loop
- Paginate pages with dynamic query
- WP_Query loop doen’t work with my custom taxonomy
- Advise on Templates for Custom Queries
- Search.php – return number of results but cannot loop through
- How do I get the content of a custom instance of WP_Query?
- Performance concerns: index.php vs taxonomy-$taxonomy.php
- Creating ‘posts page’ loop based on the page itself
- Why does apply_filters behave different inside and outside a loop?
- WordPress Queries Not Working?
- Determine if ID is page or post and query the ID
- Custom template for password protected page
- Filter subpages in while loop from WP Query object
- Use have_posts() with array of post results retrieved by $wpdb->get_results
- Custom query does not find pages
- Query WP Page for Buddypress Group Home [closed]
- How to sort by most watched in X days/months
- Magazine style frontpage with multiple categories/loops and no duplicate posts
- $post in wp_query?
- WP Query get only 1 post (sticky, not sticky etc)
- WP_Query not returning correct result with meta_query parameter
- How to pass the current content of $wp_query to a new page?
- How to make the ‘request’ filter work?
- problem with the loop
- How can I do a orderby by the number of items? So basically list by starting with the array with the largest number of post
- get_children() Archive Template
- Function the_posts_pagination() not compatible with WP_Query arguments
- How to separate two columns from one content on a page template?
- How can I use arrays and a foreach to generate many lists with WP_Query?
- How to use custom page for all posts with custom url, call another directory?
- prevent get_comments() from returning comments not in comment__in
- Custom wp_query inside a conditional stament inside a template part doesn’t work: why?
- display ACF repater field in archive page
- Is it possible to give a classname to specific comments in the WordPress admin?
- Populate select list with meta values from all posts of a Custom Post Type
- Prevent Duplicate Post Counted by Query
- How can I have sticky posts while ALSO showing posts from a specific category using one WP_Query?
- Duplice post with standard WP loop – fixed by using query_posts() instead
- WP_Query breaking the loop in a nested loop
- ACF: How can I publish values of ACF fields in a loop while using wp_query?
- Can I alter the main loop to ‘orderby’ a custom callback?
- show most viewed post
- How do I stop the same post showing multiple times in a archive?
- Check the stored / cached WP_Query with transients on post change
- New template file does not load category-specific post
- Show a message if there are no active posts in category
- Show custom content when loop or wp query reaches specific time?
- Bootstrap grid while loop
- Related posts queries
- WooCommerce | AJAX | Product Pagination | Help me implement Ajax Pagination
- Get categories within specific term
- Avoid removing duplicate posts
- Loop through array of pages
- How to show specify category template for both parent and child category
- Pagination inside the blog page not working
- Custom query for custom post type not getting correct post ID
- Woocommerce featured products query no longer working
- how to get custom attachment url?
- Ajax buttons not working properly in WooCommerce when using wc_get_template_part
- How can I use WP_Query to sort ‘event’ custom post type by date?
- Query post with content only
- Problem with my loops
- Display posts side by side with custom query