comments_popup_link() should jive better with plugins (1 post)

  1. keithorama
    Posted 9 years ago #

    comments_popup_link() does this:

    $comment_count_cache[$id] = $wpdb->get_var("SELECT COUNT(comment_ID) FROM $wpdb->comments WHERE comment_post_ID = $id AND comment_approved = '1';");

    it should probably use get_comments_number() instead. this would fix a bit of code duplication and make it more accessible to plugins since get_comments_number has plugin hooks.

    also, here

    if (0 == $number && 'closed' == $post->comment_status && 'closed' == $post->ping_status) {
    echo $none;

    comments_popup_link() short-circuits, and doesn't use a filter, so this case can't be touched by a plugin.

    i managed to work around these limitations, but it would be nice to have them in the core.

    many thanks!

Topic Closed

This topic has been closed to new replies.

About this Topic


No tags yet.