WordPress: Get Comment Count Without Pingbacks/Trackbacks


/ Published in: PHP
Save to your folder(s)

Snippet from http://www.luscarpa.com/


Copy this code and paste it in your HTML
  1. function comment_count( $count ) {
  2. if ( ! is_admin() ) {
  3. global $id;
  4. $comments_by_type = &separate_comments(get_comments('status=approve&post_id=' . $id));
  5. return count($comments_by_type['comment']);
  6. } else {
  7. return $count;
  8. }
  9. }
  10. add_filter('get_comments_number', 'comment_count', 0);

URL: http://www.luscarpa.com/snippets/wordpress/comments-number-without-pingbacks-and-trackbacks/

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.