I had the same issue, main users have the contributor role and a simple sidebar comment sidebar widget was not working when logged-in! Strange. I solved it by some sql:
function getLatestComments ( $postid ) {
global $wpdb;
$sql = "SELECT * from $wpdb->comments WHERE
comment_post_ID = $postid AND
comment_approved = 1
ORDER BY comment_ID DESC";
return $wpdb->get_results($sql);
}
I used this instead of get_comments. You may modify the sql and customize as required.
Related Posts:
- Capability for allowing user to post own comments without moderation
- Why do comment moderators need to have all create/edit/delete toboth posts and pages?
- Why the capability ‘activate_plugins’ is needed to allow a role to see all posts/pages/comments?
- How to change the email notification recipient (user) for new comments?
- how to make author to write comment on only his own posts?
- Add a drop down list to comment form?
- Prevent Contributor to show comment list
- Expanding the allowed HTML tags in comments?
- How to allow a particular role like Contributor be able to only view pending comments and approve them?
- edit_comment capability for subscriber
- Allow contributors to moderate comments comments on posts they write
- Why are authors allowed to approve comments on their posts? How to revoke privilege?
- Show comments of a user post only when they are login
- Grant a person permission to moderate all comments on a blog without giving them the ability to edit other peoples post
- Only Allow post author and “Premium” Role user to comment
- Show image next to the comment author if have certain role
- Is there a way to only allow certain user ranks to comment on a post
- Allow comments only for custom post type
- Showing different images depending on user role
- Listing comment author role code problem
- How to rearrange fields in comment_form()
- Commenting in user profile page?
- User-edit role setting distinct from wp_capabilities? [closed]
- How do I delete all comments from a specific old blog post?
- Removing the “Website” Field from Comments and Replies?
- Disallowing Users of a Custom Role from Deleting or Adding Administrators?
- Add Custom User Capabilities Before or After the Custom User Role has Been Added?
- How to load and show comments with AJAX instead of pagination?
- WordPress Capabilities: edit_user vs edit_users
- get recent comments of a particular category
- Do not allow users to create new posts and pages
- Hook/Filter before and after comments
- Comment form validation
- Is it possible to move a comment that should be a reply to another comment?
- Can I seperate comments from post?
- I have tried using Plugins to remove 72K comments with no success
- Display commenter’s registration date on comments?
- How do I display the commentor’s first name and last name in the comments?
- show un-approved comments at wordpress front end
- How to add consent checkbox in comment section
- How to add pagination to comments?
- WP 4.4.1 allow empty comments via add_action ‘pre_comment_on_post’
- How to get replies of a comment?
- How can I have different groups of editors only allowed to edit certain parent+subpages?
- Allow users to set a post author
- Share comment to twitter after publishing [closed]
- changing comment-page-# to something like review-page-#
- Community Moderation Plugin for Comments [closed]
- Bots posting comments on pages
- default callback function in wp_list_comments
- current_user_can Not Always Working Properly
- Comments deactivated
- How to dynamic Heart Like in WordPress?
- Comment Moderation and CDN Caching
- Delete all one-word comments
- Applying roles to an admin sub-menu (eg Appearance -> Menus)
- Remove Capabilities from WP admin for specific user role
- Assign author to comment from post edit page
- The “\” is missing when comments is updated
- Restricting Pages based on Hierarchy and User Role
- Posting comment returns 404
- How-To and Troubleshooting Canonical Links for Paginated Comments
- How to hide trackbacks on wp-admin/edit-comments.php
- Using a static callback on wp_insert_comment
- How to direct user after comment save
- Show comment pop up links as text only
- Displaying comments on pages distinguished by GET IDs
- Is there a hook to update / replace values in the “Enable threaded (nested) comments x levels deep” drop down?
- Update comment meta for all comments of specific post
- How to change comment texts that has a specific comment_ID – Hook into comment
- counting trackbacks, pingbacks and comments of a post
- Adding comments section to website integrated WordPress instance
- How to Define Custom Number of Items in Comment Feed
- Modify links in user comments
- How indicate when a functions was upgraded in relationship to the entire program [closed]
- Empty comments field or
- infinite loop on page with comments after changing comments.php and header.php
- What templates/funtions needed in custom theme to allow comments the new 3.0 way
- Default Gravatar not showing for pings
- How include comment and post count of user in this custom query
- How can I hide comment of the authors from their published posts?
- How to customize ‘children comments’ in WordPress?
- Disallow Comments
- Keep comment author’s name on their comment even when their account is deleted
- How can I create multiple different admin roles with their own capabilities
- Groups roles & capabilities
- WordPress Commenting System User access and Security
- Comments.php is not getting called on main blog page
- Allowing comments on author pages
- Comment section not appearing on posts
- How can I see whether a commenter has subscribed to be notified of replies / other comments to a post
- Where is the Leave a Comment link set
- Disable comment moderation in multisite
- Auto disable comments with custom field
- I want to fill the comment with the comment count?
- delete user not working
- How to remove or customize “Comment” in comments form?
- Comments on pages not appearing, even though I enabled them
- check if a comment was made by a registered user
- Manage Roles and Capabilities on Multi-site