Share:
Notifications
Clear all

Comment counter

3 Posts
2 Users
0 Likes
806 Views
Posts: 2
Topic starter
(@antibo)
New Member
Joined: 3 years ago

Hi, 

is there a way to get the number of comments for a post or CPT ?

Something like an API method getPostCommentsCount($post_id) => return (int) 125 ?

Topic Tags
2 Replies
Asti
Posts: 7056
 Asti
Support
(@asti)
Illustrious Member
Joined: 6 years ago

Hi @antibo,

You can use the get_comments_number() function. More info here: https://developer.wordpress.org/reference/functions/get_comments_number/

Reply
1 Reply
(@antibo)
Joined: 3 years ago

New Member
Posts: 2

@asti Of course ! I’m so dumb !! Sorry for that :/

Reply
Share: