Support » Plugins » Hacks » how to get value of coment_count

  • I’m trying to modify a plugin that sends emails. I don’t want it to send email when comment count = 0

    What PHP code do I need to pull that value from the wordpress database?

Viewing 1 replies (of 1 total)
  • Moderator bcworkz

    (@bcworkz)

    get_comments_number() returns the value from inside the loop. From outside the loop, you could do something like:

    $mypost= get_post($postID);
    $count = $mypost->comment_count;

Viewing 1 replies (of 1 total)
  • The topic ‘how to get value of coment_count’ is closed to new replies.