• A question about the function get_comment_count.

    The current function seems to return an array of 3 values; comments approved, spam and awaiting moderation. This does not seem to take into account the new status in 2.9.2 of trash. Instead the trash comments are included in the awaiting moderation status.

    Is this by design or is it a bug?

Viewing 3 replies - 1 through 3 (of 3 total)
  • Try wp_count_comments–for example:

    <?php
    $num_posts = wp_count_posts( 'post' );
    $num_pages = wp_count_posts( 'page' );
    $num_comm = wp_count_comments( );
    $num_cats  = wp_count_terms('category');
    $num_parent_cats=count(get_categories('parent=0&hide_empty=0'));
    $num_child_cats = $num_cats-$num_parent_cats;
    $num_tags = wp_count_terms('post_tag');
    echo '<p>number of published posts: ' . $num_posts->publish . '</p>';
    echo '<p>number of draft posts: ' . $num_posts->draft . '</p>';
    echo '<p>number of pending posts: ' . $num_posts->pending . '</p>';
    echo '<p>number of future posts: ' . $num_posts->future . '</p>';
    echo '<p>number of trash posts: ' . $num_posts->trash . '</p>';
    echo '<p>number of published pages: ' . $num_pages->publish . '</p>';
    echo '<p>number of draft pages: ' . $num_pages->draft . '</p>';
    echo '<p>number of pending pages: ' . $num_pages->pending . '</p>';
    echo '<p>number of future pages: ' . $num_pages->future . '</p>';
    echo '<p>number of trash pages: ' . $num_pages->trash . '</p>';
    echo '<p>number of approved comments: ' . $num_comm->approved . '</p>';
    echo '<p>number of moderated comments: ' . $num_comm->moderated . '</p>';
    echo '<p>number of spam comments: ' . $num_comm->spam . '</p>';
    echo '<p>number of trashed comments: ' . $num_comm->trash . '</p>';
    echo '<p>number of categories: ' . $num_cats . '</p>';
    echo '<p>number of child categories: ' . $num_child_cats . '</p>';
    echo '<p>number of tags: ' . $num_tags . '</p>';
    ?>

    Thread Starter mspecht

    (@mspecht)

    Thanks.

    Is the get_comments function being deprecated?

    Is the get_comments function being deprecated?

    Well not at 2.9.2, but you might check core.trac.www.ads-software.com for any recent activity.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘get_comment_count bug or feature?’ is closed to new replies.