How to Display Most Commented authors in WordPress

Add Tool

Display Most Commented authors in WordPress


Want to Display Most Commented authors in WordPress Sidebar of you website? There are many top commenter plugins that display the top commenters for your site in your widget areas. If you want to use wordpress code to display most Commented authors prefer to  this functionality into your theme. Simply add this to your functions.php file.

function top_comment_authors($amount = 5) {
global $wpdb;
$results = $wpdb->get_results('
    SELECT
    COUNT(comment_author_email) AS comments_count, comment_author_email, comment_author, comment_author_url
    FROM '.$wpdb->comments.'
    WHERE comment_author_email != "" AND comment_type = "" AND comment_approved = 1
    GROUP BY comment_author_email
    ORDER BY comments_count DESC, comment_author ASC
    LIMIT '.$amount
);
$output = "<ul>";
foreach($results as $result) {
    $output .= "<li>".$result->comment_author."</li>";
}
$output .= "</ul>";
echo $output;
}

You can then display the top commenters anywhere on your site by adding it to a template such as sidebar.php or footer.php.

<?php top_comment_authors(); ?>

Tags: best wordpress sidebar plugins, Most Commented authors, commenter plugins,top commenters, wordpress code, wordpress snippets
Payza

About Masum Billah

Display Most Commented authors in WordPress 1stWebSuite website seo tool is a free website ranking tool site provides a lot of on page and off page seo useful tools for you. On this site, we have a large number of website ranking tools


SIGN UP TO GET UPDATE TO YOUR INBOX




Discuss about: How to Display Most Commented authors in WordPress


adf.ly