Note that the function wp_list_comments() doesn’t fetch the comments, only displays them in various ways depending on the input arguments.
You’re actually using the WP_Comment_Query/get_comments input arguments into wp_list_comments().
You could try this instead:
$postID = 12345; // Adjust this!
$comments = get_comments(
[
'date_query' => [
'after' => '5 minutes ago',
'inclusive' => true,
],
'post_id' => $postID,
'status' => 'approve',
]
);
printf(
'<ol>%s<ol>',
wp_list_comments( $args = [ 'echo' => 0 ], $comments )
);
where you can play with the comment output through the $args input array.
Check the Codex here.
Note that we can skip the before attribute when we use after attribute.
Related Posts:
- WP_Comment_Query pagination, delving into the unknown
- Exclude comments from a WP_Query object?
- Get posts with condition on comment meta value
- WP_Query sort by comment meta data
- Get number of comments after modifying comment query
- using wp_query to return posts w/ comment count > 0
- How to target the default Recent Posts and Recent Comments widgets with pre_get_posts?
- Query posts with more than 20 comments
- Sorting posts DESC based on the number of comments using WP_Query
- Most commented last 24h, week, month, year and all time – posts_where
- Most commented post showing 2 records
- WordPress Comments sort by custom meta key
- Query posts by last comments
- How to list posts with disabled/closed comments, with pagination?
- I need help using pre_get_comments to limit comments in the comments admin screen
- All Posts Have The Same Comments
- prevent get_comments() from returning comments not in comment__in
- Is it possible to give a classname to specific comments in the WordPress admin?
- How to get_comments() ordered by date and parent?
- Comments orderby comment date not working
- How to display comments list by order when clicking on newest or oldest link?
- Get comment number by date range?
- How to filter a query by multiple meta keys and order by other meta keys
- Multiple Orderby’s using random order WP_Query
- using pre_get_posts for search results not found
- How to query for all posts that have a particular meta key?
- How can I override one post and make it display content for another post?
- Ajax future single post query doesn’t work when NOT logged in
- How modify the comment content persistently based on $wp_query?
- Exclude parent with child pages from WP_Query
- Co-authors list of all posts
- Get multiple users with meta value in one query and populate WP_User class
- get_posts always returning the same number of posts = 5
- WP_Query calls all posts?
- WP_Query Taxonomy categories filtering
- WP_Query: apply an SQL function to meta fileld value
- The best way to store variable across different widgets
- Assign a minimum result count for WooCommerce query shortcodes?
- WPQuery calling specific posts problem
- Retrieve data from wordpress db via input and put those result in dropdown
- Overriding $wp_query on a template
- How to use ‘WP_Query’ or ‘query_posts’ to display content in a descending order
- How to display specific ids of posts using wp_query?
- Filtering by multiple conditions in the loop
- Limit loop to future events
- Display count number of posts with the same specific meta_key meta_value
- Echo User Name from User with most comments of today?
- Custom wp_query differs on index page and category page
- Tax_Query using WP_Query not working
- WordPress Queries Not Working?
- How to stack name list in non-alphabetical order?
- Magazine style frontpage with multiple categories/loops and no duplicate posts
- orderby ignored by wp_query
- $wp_query->found_posts not returning correct value
- How to make a post with certain taxonomy term display first before other post with only one query?
- Exception for excluding previously displayed posts in queries
- How do I compare the value of two taxonomies in a wp_query
- Apply a custom WP_Query to the whole multisite network
- display ACF repater field in archive page
- Custom Taxonomy Archive Page to display either ALL listings or only from URL
- query hook parse_tax_query function takes no effect
- Meta query ignores multiple values of the key
- Any way to use FETCH_KEY_PAIR with $wpdb?
- Query by meta key and order by another meta key value
- Filter admin ajax data by url query
- Related posts queries
- Check for not NULL not working in meta query
- Display hierarchical structure of Custom post type in UL LI
- Pagination for Category does not work
- Using a variable within the blog posts array query – posts_per_page as variable
- Complex Meta Query
- Order search results by multiple post_types
- Single query for multiple categories
- ACF query-pass field value
- How to make a search query if not found in post table then search in postmeta table?
- Best way to query posts and order by relevancy to query
- Woocommerce WP_Query post__not_in problem
- how to show more than 1 post into three columns query
- How to combine nested tax_query logic with other nested query logic?
- complex query question
- tax_query not working for taxonomy slug
- Problem with infinite scroll on multisite with custom query
- custom query – offset to pagination
- Order Custom Field by Price
- How to Insert data with wp cron
- Get X posts for all post types on Taxonomy term archive
- How to list posts of a given format
- When should you use WP_Query vs query_posts() vs get_posts()?
- Stop link being removed in menu/list when viewing that post
- WP Query Bug? Cannot find out why posts are not found!
- Can’t get pagination to work with this WP_Query loop
- Passing additional variables to a query
- Pagination in custom loop [duplicate]
- get contents and permalink from a specified page
- What query to append the 10 next posts?
- wp query problem
- How ‘secure’ are loops?
- What triggers these wordpress queries on my homepage?
- Custom query for certain post type OR another post type with a certain category
- Custom Taxonomy in custom REST API search