i thinks this help to you
$args = array (
'status' => 'approve',
'number' => '5'
);
$comments = get_comments( $args );
if ( !empty( $comments ) ) :
echo '<ul>';
foreach( $comments as $comment ) :
echo '<li><a href="' . get_permalink( $comment->comment_post_ID ) . '#comment-' . $comment->comment_ID . '">' . $comment->comment_author . ' on ' . get_the_title( $comment->comment_post_ID ) . '</a></li>';
endforeach;
echo '</ul>';
endif;
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
- How can I retrieve comments from last 5 minutes for a post?
- 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
- 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?
- Pagination with custom SQL query
- How to query for most viewed posts and show top 5
- How to list some posts first in the loop based on post id
- Different ‘posts_per_page’ setting for first, and rest of the paginated pages?
- Add indexing to meta_value in wp_postmeta
- Custom WP_Query order by post_meta and (author) user_meta
- How to order posts tag by tag?
- Want to redirect if search query match exact title of any post
- Most commented post should be the first post in the blog
- get data from wp-query, outside the loop & without url change
- Search another database with wp_query using new wpdb
- Custom page template query_vars
- Compare two meta-fields in a wp_query (where meta-field-A is larger than meta-field-B)
- Querying by taxonomy vs Querying by Custom fields Speed Comparison
- WP_Query class not found
- Splitting the main query in multiple loops with query_posts and/or pre_get_posts?
- Order WP Query posts by custom order calculated from post meta values
- WP_Query mixe post and page attributes
- How do you Query posts with nothing in common?
- Exhausted memory limit with very simple WP_Query
- When to add_filter() to Custom Query
- if/else on custom query gives 200 OK when condition not met?
- Creating arguments from loop for WP_Query meta_query
- Select from wp_post and multiple meta_value from wp_postmeta
- Multiple Loops Inside a Function
- How to use MySQL’s MATCH AGAINST in WP_Query?
- Ajax Pagination on Ajax filter
- Wp_query returning only one post while query through ajax
- Can I set my WP_Query to be a Main Query?
- How to use external API content in place of WP posts using $wp_query?
- Make a page return false to is_single() and true for is_post_type_archive() before wp_enqueue_scripts
- category query for pages not working
- date_query on draft posts only
- Current post in AJAX call is always zero
- Multiple filter conditions for WP_Query
- Exclude some authors from query
- apply custom where to the default $wp_query
- wp_query serialised array
- Conditional operator OR not working with custom fields
- How to add custom meta to ‘pre_get_terms’?
- How do I check if an article is popular this week?
- Using Transients
- Should I reset $wp_query?
- Sorting search results with custom dropdown
- Posts query according to meta box date
- create metabox to activate slider
- problem with loop
- WP_Query will not display draft posts
- How do I get the content of a custom instance of WP_Query?
- Change post query onclick
- Display upcoming events in the next 30 days by querying posts with timestamp in custom meta
- Searching not only by post name but also category
- WP_Query, Paginate by Custom Field
- Query post and sort by custom value calculated with custom field on cpt
- WP_Query() not working as expected
- How to sort store location by specific category order in WP store locations
- Posts per Page not working
- Trouble with serialized metadata
- Custom filter from post meta
- Is there documentation for objects returned by WP_Query?
- Multiple wpostmeta.meta_key
- Custom post type loop error: Trying to get property of non-object
- Search Field that allows options of “Match any keyword” or “Match all keywords”
- Saving custom fields for WP_Query to retrieve
- Getting the last X posts, but in ascending order of time
- Modify query to exclude certain ids and certain parents and its corresponding children
- How to fix pagination for custom loops on front-page.php
- WP_Query with MetaQuery issue
- Cannot order by in WP_Query
- How to sort a WP_Query array by post_name after an array_merge();
- Comment count same for every post in homepage WP_Query
- WP_Query breaks pagination
- wpdb LIKE request shows all database data
- query_vars category_name only display one catgory out of multiple categories
- Incorrect posts displayed on category page
- Sort by multiple columns using get_posts
- WP_Query filter Posts by timestamp event (range start and end) and by month (next 12 month)
- Showing all posts of the current custom taxonomy on archive page