You can use the get_comments()
function like so:
$total = get_comments( array(
'post_author' => get_current_user_id(),
'post_status' => 'publish',
'type' => 'comment',
'count' => true,
) );
echo 'total comments of your all posts : ' . $total;
Just customize the arguments based on your requirements/preferences, and in the above example, I’m retrieving the total number of comments for published posts where the author is the currently logged-in user, but only for comments of the comment
type.
And if you want, you can use the status
argument to limit to certain status only, e.g. approve
to count approved comments only.
Related Posts:
- Hide comments awaiting moderation from user who submitted the comments
- Limit number of posts a user can make per minute?
- how to find user ids of all commenters in a post
- How to allow logged in users to post anonymously
- How do I manage my users post before publish?
- Assign published posts to another user automatically
- Hide comments and posts posted by other user
- Undefined Function Fatal Error with Shortcode [closed]
- Update post counts (published, draft, unattached) in admin interface
- add action only on post publish – not update
- How to make comments work for a post loaded per Ajax?
- How to prevent posts from being published too close to each other?
- How to Display a List of Users Who Have Made at Least 1 Post?
- Find out who deleted a page or post?
- Is it possible to Schedule Attachments in WordPress?
- Allow variable amount of comments before pagination
- Elegant way to include only published posts with get_objects_in_term()?
- WordPress: How to get the current logged in author page URL?
- get comments and get posts in loop
- WordPress plugin to publish to multiple remote WordPress blogs
- Post publish only hook?
- Publish pending article from front end with a button?
- disable password protected page for logged users
- How to add a “publish” link to the quick actions
- How to limit user to publish post per day and per role?
- When a user creates a post (pending), send a confirmation link that allows them to publish
- How to display comments and comment form on custom post type?
- Force “Submit to review” when a post is updated
- In what sequence are the hooks fired when a post is “published”?
- Comments are assigned to wrong or related post
- Restrict the Number of Posts an Author can Publish (over time)?
- Add javascript when post is published
- How can I allow editors to leave comments on posts that have not yet been published?
- Update post date on every new comment?
- featuring old articles without messing up with the archive
- One comment per user email per post
- Can’t show comments count per post outside loop
- Publish posts only after the condition is met
- Only display posts with comments
- Overview with latest edited posts and pages
- Navigation link to specific user page
- Hiding by default specific post status on backend list?
- Comments enabled, but disabled at the same time
- Comments not showing in custom post type – WordPress
- Get how many days since last post of the current user
- How to output comments number of a post per day?
- Enable commenting on front-end preview page for pending posts
- Detect Post Type when publish_post is ran
- How can I display a specific user’s first published post?
- Does WordPress remove draft status automatically?
- Query All users that has post
- What Can I Use To Add A Custom Button Between Publish button and Move To Trash?
- Prevent post from being published if no category selected
- Send email to user that his post has been rejected
- How do I allow users to follow a post and then allow admins to email all users who have followed that post?
- wp_insert_post let users post to without login…broke
- Hide Post comments when displayed via WP_Query
- Get user’s most published categories
- Including new Javascript only after a comment is made
- Allow anonymous users to post to my site for moderation
- Every possible way to get data (posts) from WordPress
- Disable Post/Page comment emails for creators
- publish_post conflicts with save_post
- 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?
- disable column on post and user list
- Notification to Admin or Author upon new post [duplicate]
- What differences are there between a Privately Published post and a Draft post?
- How to run a function when post is edited or updated using publish post action?
- How can I create custom button in post.php
- When trashing a post, also trash related comments
- How to list users and their post amount?
- Diplay comment date on WP_Post_Comments_List_Table
- Is there any way to allow users to access content before it’s published?
- UberMenu list current user’s posts as menu items
- How to rename “Publish” metabox title in post screen
- Posts vs. Pages
- Create post for every user?
- Automatically Updating Publish Date Bug
- How to Orderby Comments by post title?
- How can I schedule a PAGE to go live at a future date/time?
- Restrict users post for himself
- How to give capability (publish contributors posts) to author role?
- If modified on same day, show only time
- Allow public to post on blog
- Email entire post contents
- Print a message if excerpt is empty after posts have been publish/update!
- Query get post,how to add comment box
- current post with current author
- Check if checkbox is marked on publish/update post
- Update all comments time to random dates?
- How to verify wp user password by sql query in wp? [closed]
- Decide user that can publish a post
- How to switch wordpress post status between publish and schedule in MySQL?
- Enable Comments Box On Custom Post Type
- How can i delay reading posing in 3days for not logined user?
- Encountering “Wrong nonce. Action prohibitied.” when trying to alter User Role and unable to Post via WP Admin
- Turn On Comments On Custom Post Types in Directory Theme
- Emojis replaced by ‘?’ automatically