wp_dashboard_recent_comments

The timeline below displays how wordpress function wp_dashboard_recent_comments has changed across different WordPress versions. If a version is not listed, refer to the next available version below.

WordPress Version: 6.5

/**
 * Show Comments section.
 *
 * @since 3.8.0
 *
 * @param int $total_items Optional. Number of comments to query. Default 5.
 * @return bool False if no comments were found. True otherwise.
 */
function wp_dashboard_recent_comments($total_items = 5)
{
    // Select all comment types and filter out spam later for better query performance.
    $comments = array();
    $comments_query = array('number' => $total_items * 5, 'offset' => 0);
    if (!current_user_can('edit_posts')) {
        $comments_query['status'] = 'approve';
    }
    while (count($comments) < $total_items && $possible = get_comments($comments_query)) {
        if (!is_array($possible)) {
            break;
        }
        foreach ($possible as $comment) {
            if (!current_user_can('edit_post', $comment->comment_post_ID) && (post_password_required($comment->comment_post_ID) || !current_user_can('read_post', $comment->comment_post_ID))) {
                // The user has no access to the post and thus cannot see the comments.
                continue;
            }
            $comments[] = $comment;
            if (count($comments) === $total_items) {
                break 2;
            }
        }
        $comments_query['offset'] += $comments_query['number'];
        $comments_query['number'] = $total_items * 10;
    }
    if ($comments) {
        echo '<div id="latest-comments" class="activity-block table-view-list">';
        echo '<h3>' . __('Recent Comments') . '</h3>';
        echo '<ul id="the-comment-list" data-wp-lists="list:comment">';
        foreach ($comments as $comment) {
            _wp_dashboard_recent_comments_row($comment);
        }
        echo '</ul>';
        if (current_user_can('edit_posts')) {
            echo '<h3 class="screen-reader-text">' . __('View more comments') . '</h3>';
            _get_list_table('WP_Comments_List_Table')->views();
        }
        wp_comment_reply(-1, false, 'dashboard', false);
        wp_comment_trashnotice();
        echo '</div>';
    } else {
        return false;
    }
    return true;
}

WordPress Version: 3.2

/**
 * Show Comments section.
 *
 * @since 3.8.0
 *
 * @param int $total_items Optional. Number of comments to query. Default 5.
 * @return bool False if no comments were found. True otherwise.
 */
function wp_dashboard_recent_comments($total_items = 5)
{
    // Select all comment types and filter out spam later for better query performance.
    $comments = array();
    $comments_query = array('number' => $total_items * 5, 'offset' => 0);
    if (!current_user_can('edit_posts')) {
        $comments_query['status'] = 'approve';
    }
    while (count($comments) < $total_items && $possible = get_comments($comments_query)) {
        if (!is_array($possible)) {
            break;
        }
        foreach ($possible as $comment) {
            if (!current_user_can('read_post', $comment->comment_post_ID)) {
                continue;
            }
            $comments[] = $comment;
            if (count($comments) === $total_items) {
                break 2;
            }
        }
        $comments_query['offset'] += $comments_query['number'];
        $comments_query['number'] = $total_items * 10;
    }
    if ($comments) {
        echo '<div id="latest-comments" class="activity-block table-view-list">';
        echo '<h3>' . __('Recent Comments') . '</h3>';
        echo '<ul id="the-comment-list" data-wp-lists="list:comment">';
        foreach ($comments as $comment) {
            $comment_post = get_post($comment->comment_post_ID);
            if (current_user_can('edit_post', $comment->comment_post_ID) || empty($comment_post->post_password) && current_user_can('read_post', $comment->comment_post_ID)) {
                _wp_dashboard_recent_comments_row($comment);
            }
        }
        echo '</ul>';
        if (current_user_can('edit_posts')) {
            echo '<h3 class="screen-reader-text">' . __('View more comments') . '</h3>';
            _get_list_table('WP_Comments_List_Table')->views();
        }
        wp_comment_reply(-1, false, 'dashboard', false);
        wp_comment_trashnotice();
        echo '</div>';
    } else {
        return false;
    }
    return true;
}

WordPress Version: 6.3

/**
 * Show Comments section.
 *
 * @since 3.8.0
 *
 * @param int $total_items Optional. Number of comments to query. Default 5.
 * @return bool False if no comments were found. True otherwise.
 */
function wp_dashboard_recent_comments($total_items = 5)
{
    // Select all comment types and filter out spam later for better query performance.
    $comments = array();
    $comments_query = array('number' => $total_items * 5, 'offset' => 0);
    if (!current_user_can('edit_posts')) {
        $comments_query['status'] = 'approve';
    }
    while (count($comments) < $total_items && $possible = get_comments($comments_query)) {
        if (!is_array($possible)) {
            break;
        }
        foreach ($possible as $comment) {
            if (!current_user_can('read_post', $comment->comment_post_ID)) {
                continue;
            }
            $comments[] = $comment;
            if (count($comments) === $total_items) {
                break 2;
            }
        }
        $comments_query['offset'] += $comments_query['number'];
        $comments_query['number'] = $total_items * 10;
    }
    if ($comments) {
        echo '<div id="latest-comments" class="activity-block table-view-list">';
        echo '<h3>' . __('Recent Comments') . '</h3>';
        echo '<ul id="the-comment-list" data-wp-lists="list:comment">';
        foreach ($comments as $comment) {
            _wp_dashboard_recent_comments_row($comment);
        }
        echo '</ul>';
        if (current_user_can('edit_posts')) {
            echo '<h3 class="screen-reader-text">' . __('View more comments') . '</h3>';
            _get_list_table('WP_Comments_List_Table')->views();
        }
        wp_comment_reply(-1, false, 'dashboard', false);
        wp_comment_trashnotice();
        echo '</div>';
    } else {
        return false;
    }
    return true;
}

WordPress Version: 2.3

/**
 * Show Comments section.
 *
 * @since 3.8.0
 *
 * @param int $total_items Optional. Number of comments to query. Default 5.
 * @return bool False if no comments were found. True otherwise.
 */
function wp_dashboard_recent_comments($total_items = 5)
{
    // Select all comment types and filter out spam later for better query performance.
    $comments = array();
    $comments_query = array('number' => $total_items * 5, 'offset' => 0);
    if (!current_user_can('edit_posts')) {
        $comments_query['status'] = 'approve';
    }
    while (count($comments) < $total_items && $possible = get_comments($comments_query)) {
        if (!is_array($possible)) {
            break;
        }
        foreach ($possible as $comment) {
            if (!current_user_can('read_post', $comment->comment_post_ID)) {
                continue;
            }
            $comments[] = $comment;
            if (count($comments) === $total_items) {
                break 2;
            }
        }
        $comments_query['offset'] += $comments_query['number'];
        $comments_query['number'] = $total_items * 10;
    }
    if ($comments) {
        echo '<div id="latest-comments" class="activity-block table-view-list">';
        echo '<h3>' . __('Recent Comments') . '</h3>';
        echo '<ul id="the-comment-list" data-wp-lists="list:comment">';
        foreach ($comments as $comment) {
            $comment_post = get_post($comment->comment_post_ID);
            if (current_user_can('edit_post', $comment->comment_post_ID) || empty($comment_post->post_password) && current_user_can('read_post', $comment->comment_post_ID)) {
                _wp_dashboard_recent_comments_row($comment);
            }
        }
        echo '</ul>';
        if (current_user_can('edit_posts')) {
            echo '<h3 class="screen-reader-text">' . __('View more comments') . '</h3>';
            _get_list_table('WP_Comments_List_Table')->views();
        }
        wp_comment_reply(-1, false, 'dashboard', false);
        wp_comment_trashnotice();
        echo '</div>';
    } else {
        return false;
    }
    return true;
}

WordPress Version: 6.2

/**
 * Show Comments section.
 *
 * @since 3.8.0
 *
 * @param int $total_items Optional. Number of comments to query. Default 5.
 * @return bool False if no comments were found. True otherwise.
 */
function wp_dashboard_recent_comments($total_items = 5)
{
    // Select all comment types and filter out spam later for better query performance.
    $comments = array();
    $comments_query = array('number' => $total_items * 5, 'offset' => 0);
    if (!current_user_can('edit_posts')) {
        $comments_query['status'] = 'approve';
    }
    while (count($comments) < $total_items && $possible = get_comments($comments_query)) {
        if (!is_array($possible)) {
            break;
        }
        foreach ($possible as $comment) {
            if (!current_user_can('read_post', $comment->comment_post_ID)) {
                continue;
            }
            $comments[] = $comment;
            if (count($comments) === $total_items) {
                break 2;
            }
        }
        $comments_query['offset'] += $comments_query['number'];
        $comments_query['number'] = $total_items * 10;
    }
    if ($comments) {
        echo '<div id="latest-comments" class="activity-block table-view-list">';
        echo '<h3>' . __('Recent Comments') . '</h3>';
        echo '<ul id="the-comment-list" data-wp-lists="list:comment">';
        foreach ($comments as $comment) {
            _wp_dashboard_recent_comments_row($comment);
        }
        echo '</ul>';
        if (current_user_can('edit_posts')) {
            echo '<h3 class="screen-reader-text">' . __('View more comments') . '</h3>';
            _get_list_table('WP_Comments_List_Table')->views();
        }
        wp_comment_reply(-1, false, 'dashboard', false);
        wp_comment_trashnotice();
        echo '</div>';
    } else {
        return false;
    }
    return true;
}

WordPress Version: 1.4

/**
 * Show Comments section.
 *
 * @since 3.8.0
 *
 * @param int $total_items Optional. Number of comments to query. Default 5.
 * @return bool False if no comments were found. True otherwise.
 */
function wp_dashboard_recent_comments($total_items = 5)
{
    // Select all comment types and filter out spam later for better query performance.
    $comments = array();
    $comments_query = array('number' => $total_items * 5, 'offset' => 0);
    if (!current_user_can('edit_posts')) {
        $comments_query['status'] = 'approve';
    }
    while (count($comments) < $total_items && $possible = get_comments($comments_query)) {
        if (!is_array($possible)) {
            break;
        }
        foreach ($possible as $comment) {
            if (!current_user_can('read_post', $comment->comment_post_ID)) {
                continue;
            }
            $comments[] = $comment;
            if (count($comments) === $total_items) {
                break 2;
            }
        }
        $comments_query['offset'] += $comments_query['number'];
        $comments_query['number'] = $total_items * 10;
    }
    if ($comments) {
        echo '<div id="latest-comments" class="activity-block table-view-list">';
        echo '<h3>' . __('Recent Comments') . '</h3>';
        echo '<ul id="the-comment-list" data-wp-lists="list:comment">';
        foreach ($comments as $comment) {
            $comment_post = get_post($comment->comment_post_ID);
            if (current_user_can('edit_post', $comment->comment_post_ID) || empty($comment_post->post_password) && current_user_can('read_post', $comment->comment_post_ID)) {
                _wp_dashboard_recent_comments_row($comment);
            }
        }
        echo '</ul>';
        if (current_user_can('edit_posts')) {
            echo '<h3 class="screen-reader-text">' . __('View more comments') . '</h3>';
            _get_list_table('WP_Comments_List_Table')->views();
        }
        wp_comment_reply(-1, false, 'dashboard', false);
        wp_comment_trashnotice();
        echo '</div>';
    } else {
        return false;
    }
    return true;
}

WordPress Version: 6.1

/**
 * Show Comments section.
 *
 * @since 3.8.0
 *
 * @param int $total_items Optional. Number of comments to query. Default 5.
 * @return bool False if no comments were found. True otherwise.
 */
function wp_dashboard_recent_comments($total_items = 5)
{
    // Select all comment types and filter out spam later for better query performance.
    $comments = array();
    $comments_query = array('number' => $total_items * 5, 'offset' => 0);
    if (!current_user_can('edit_posts')) {
        $comments_query['status'] = 'approve';
    }
    while (count($comments) < $total_items && $possible = get_comments($comments_query)) {
        if (!is_array($possible)) {
            break;
        }
        foreach ($possible as $comment) {
            if (!current_user_can('read_post', $comment->comment_post_ID)) {
                continue;
            }
            $comments[] = $comment;
            if (count($comments) === $total_items) {
                break 2;
            }
        }
        $comments_query['offset'] += $comments_query['number'];
        $comments_query['number'] = $total_items * 10;
    }
    if ($comments) {
        echo '<div id="latest-comments" class="activity-block table-view-list">';
        echo '<h3>' . __('Recent Comments') . '</h3>';
        echo '<ul id="the-comment-list" data-wp-lists="list:comment">';
        foreach ($comments as $comment) {
            _wp_dashboard_recent_comments_row($comment);
        }
        echo '</ul>';
        if (current_user_can('edit_posts')) {
            echo '<h3 class="screen-reader-text">' . __('View more comments') . '</h3>';
            _get_list_table('WP_Comments_List_Table')->views();
        }
        wp_comment_reply(-1, false, 'dashboard', false);
        wp_comment_trashnotice();
        echo '</div>';
    } else {
        return false;
    }
    return true;
}

WordPress Version: 9.8

/**
 * Show Comments section.
 *
 * @since 3.8.0
 *
 * @param int $total_items Optional. Number of comments to query. Default 5.
 * @return bool False if no comments were found. True otherwise.
 */
function wp_dashboard_recent_comments($total_items = 5)
{
    // Select all comment types and filter out spam later for better query performance.
    $comments = array();
    $comments_query = array('number' => $total_items * 5, 'offset' => 0);
    if (!current_user_can('edit_posts')) {
        $comments_query['status'] = 'approve';
    }
    while (count($comments) < $total_items && $possible = get_comments($comments_query)) {
        if (!is_array($possible)) {
            break;
        }
        foreach ($possible as $comment) {
            if (!current_user_can('read_post', $comment->comment_post_ID)) {
                continue;
            }
            $comments[] = $comment;
            if (count($comments) === $total_items) {
                break 2;
            }
        }
        $comments_query['offset'] += $comments_query['number'];
        $comments_query['number'] = $total_items * 10;
    }
    if ($comments) {
        echo '<div id="latest-comments" class="activity-block table-view-list">';
        echo '<h3>' . __('Recent Comments') . '</h3>';
        echo '<ul id="the-comment-list" data-wp-lists="list:comment">';
        foreach ($comments as $comment) {
            $comment_post = get_post($comment->comment_post_ID);
            if (current_user_can('edit_post', $comment->comment_post_ID) || empty($comment_post->post_password) && current_user_can('read_post', $comment->comment_post_ID)) {
                _wp_dashboard_recent_comments_row($comment);
            }
        }
        echo '</ul>';
        if (current_user_can('edit_posts')) {
            echo '<h3 class="screen-reader-text">' . __('View more comments') . '</h3>';
            _get_list_table('WP_Comments_List_Table')->views();
        }
        wp_comment_reply(-1, false, 'dashboard', false);
        wp_comment_trashnotice();
        echo '</div>';
    } else {
        return false;
    }
    return true;
}

WordPress Version: 5.9

/**
 * Show Comments section.
 *
 * @since 3.8.0
 *
 * @param int $total_items Optional. Number of comments to query. Default 5.
 * @return bool False if no comments were found. True otherwise.
 */
function wp_dashboard_recent_comments($total_items = 5)
{
    // Select all comment types and filter out spam later for better query performance.
    $comments = array();
    $comments_query = array('number' => $total_items * 5, 'offset' => 0);
    if (!current_user_can('edit_posts')) {
        $comments_query['status'] = 'approve';
    }
    while (count($comments) < $total_items && $possible = get_comments($comments_query)) {
        if (!is_array($possible)) {
            break;
        }
        foreach ($possible as $comment) {
            if (!current_user_can('read_post', $comment->comment_post_ID)) {
                continue;
            }
            $comments[] = $comment;
            if (count($comments) === $total_items) {
                break 2;
            }
        }
        $comments_query['offset'] += $comments_query['number'];
        $comments_query['number'] = $total_items * 10;
    }
    if ($comments) {
        echo '<div id="latest-comments" class="activity-block table-view-list">';
        echo '<h3>' . __('Recent Comments') . '</h3>';
        echo '<ul id="the-comment-list" data-wp-lists="list:comment">';
        foreach ($comments as $comment) {
            _wp_dashboard_recent_comments_row($comment);
        }
        echo '</ul>';
        if (current_user_can('edit_posts')) {
            echo '<h3 class="screen-reader-text">' . __('View more comments') . '</h3>';
            _get_list_table('WP_Comments_List_Table')->views();
        }
        wp_comment_reply(-1, false, 'dashboard', false);
        wp_comment_trashnotice();
        echo '</div>';
    } else {
        return false;
    }
    return true;
}

WordPress Version: 8.8

/**
 * Show Comments section.
 *
 * @since 3.8.0
 *
 * @param int $total_items Optional. Number of comments to query. Default 5.
 * @return bool False if no comments were found. True otherwise.
 */
function wp_dashboard_recent_comments($total_items = 5)
{
    // Select all comment types and filter out spam later for better query performance.
    $comments = array();
    $comments_query = array('number' => $total_items * 5, 'offset' => 0);
    if (!current_user_can('edit_posts')) {
        $comments_query['status'] = 'approve';
    }
    while (count($comments) < $total_items && $possible = get_comments($comments_query)) {
        if (!is_array($possible)) {
            break;
        }
        foreach ($possible as $comment) {
            if (!current_user_can('read_post', $comment->comment_post_ID)) {
                continue;
            }
            $comments[] = $comment;
            if (count($comments) === $total_items) {
                break 2;
            }
        }
        $comments_query['offset'] += $comments_query['number'];
        $comments_query['number'] = $total_items * 10;
    }
    if ($comments) {
        echo '<div id="latest-comments" class="activity-block table-view-list">';
        echo '<h3>' . __('Recent Comments') . '</h3>';
        echo '<ul id="the-comment-list" data-wp-lists="list:comment">';
        foreach ($comments as $comment) {
            $comment_post = get_post($comment->comment_post_ID);
            if (current_user_can('edit_post', $comment->comment_post_ID) || empty($comment_post->post_password) && current_user_can('read_post', $comment->comment_post_ID)) {
                _wp_dashboard_recent_comments_row($comment);
            }
        }
        echo '</ul>';
        if (current_user_can('edit_posts')) {
            echo '<h3 class="screen-reader-text">' . __('View more comments') . '</h3>';
            _get_list_table('WP_Comments_List_Table')->views();
        }
        wp_comment_reply(-1, false, 'dashboard', false);
        wp_comment_trashnotice();
        echo '</div>';
    } else {
        return false;
    }
    return true;
}

WordPress Version: 5.8

/**
 * Show Comments section.
 *
 * @since 3.8.0
 *
 * @param int $total_items Optional. Number of comments to query. Default 5.
 * @return bool False if no comments were found. True otherwise.
 */
function wp_dashboard_recent_comments($total_items = 5)
{
    // Select all comment types and filter out spam later for better query performance.
    $comments = array();
    $comments_query = array('number' => $total_items * 5, 'offset' => 0);
    if (!current_user_can('edit_posts')) {
        $comments_query['status'] = 'approve';
    }
    while (count($comments) < $total_items && $possible = get_comments($comments_query)) {
        if (!is_array($possible)) {
            break;
        }
        foreach ($possible as $comment) {
            if (!current_user_can('read_post', $comment->comment_post_ID)) {
                continue;
            }
            $comments[] = $comment;
            if (count($comments) === $total_items) {
                break 2;
            }
        }
        $comments_query['offset'] += $comments_query['number'];
        $comments_query['number'] = $total_items * 10;
    }
    if ($comments) {
        echo '<div id="latest-comments" class="activity-block table-view-list">';
        echo '<h3>' . __('Recent Comments') . '</h3>';
        echo '<ul id="the-comment-list" data-wp-lists="list:comment">';
        foreach ($comments as $comment) {
            _wp_dashboard_recent_comments_row($comment);
        }
        echo '</ul>';
        if (current_user_can('edit_posts')) {
            echo '<h3 class="screen-reader-text">' . __('View more comments') . '</h3>';
            _get_list_table('WP_Comments_List_Table')->views();
        }
        wp_comment_reply(-1, false, 'dashboard', false);
        wp_comment_trashnotice();
        echo '</div>';
    } else {
        return false;
    }
    return true;
}

WordPress Version: 7.2

/**
 * Show Comments section.
 *
 * @since 3.8.0
 *
 * @param int $total_items Optional. Number of comments to query. Default 5.
 * @return bool False if no comments were found. True otherwise.
 */
function wp_dashboard_recent_comments($total_items = 5)
{
    // Select all comment types and filter out spam later for better query performance.
    $comments = array();
    $comments_query = array('number' => $total_items * 5, 'offset' => 0);
    if (!current_user_can('edit_posts')) {
        $comments_query['status'] = 'approve';
    }
    while (count($comments) < $total_items && $possible = get_comments($comments_query)) {
        if (!is_array($possible)) {
            break;
        }
        foreach ($possible as $comment) {
            if (!current_user_can('read_post', $comment->comment_post_ID)) {
                continue;
            }
            $comments[] = $comment;
            if (count($comments) == $total_items) {
                break 2;
            }
        }
        $comments_query['offset'] += $comments_query['number'];
        $comments_query['number'] = $total_items * 10;
    }
    if ($comments) {
        echo '<div id="latest-comments" class="activity-block table-view-list">';
        echo '<h3>' . __('Recent Comments') . '</h3>';
        echo '<ul id="the-comment-list" data-wp-lists="list:comment">';
        foreach ($comments as $comment) {
            _wp_dashboard_recent_comments_row($comment);
        }
        echo '</ul>';
        if (current_user_can('edit_posts')) {
            echo '<h3 class="screen-reader-text">' . __('View more comments') . '</h3>';
            _get_list_table('WP_Comments_List_Table')->views();
        }
        wp_comment_reply(-1, false, 'dashboard', false);
        wp_comment_trashnotice();
        echo '</div>';
    } else {
        return false;
    }
    return true;
}

WordPress Version: .10

/**
 * Show Comments section.
 *
 * @since 3.8.0
 *
 * @param int $total_items Optional. Number of comments to query. Default 5.
 * @return bool False if no comments were found. True otherwise.
 */
function wp_dashboard_recent_comments($total_items = 5)
{
    // Select all comment types and filter out spam later for better query performance.
    $comments = array();
    $comments_query = array('number' => $total_items * 5, 'offset' => 0);
    if (!current_user_can('edit_posts')) {
        $comments_query['status'] = 'approve';
    }
    while (count($comments) < $total_items && $possible = get_comments($comments_query)) {
        if (!is_array($possible)) {
            break;
        }
        foreach ($possible as $comment) {
            if (!current_user_can('read_post', $comment->comment_post_ID)) {
                continue;
            }
            $comments[] = $comment;
            if (count($comments) == $total_items) {
                break 2;
            }
        }
        $comments_query['offset'] += $comments_query['number'];
        $comments_query['number'] = $total_items * 10;
    }
    if ($comments) {
        echo '<div id="latest-comments" class="activity-block table-view-list">';
        echo '<h3>' . __('Recent Comments') . '</h3>';
        echo '<ul id="the-comment-list" data-wp-lists="list:comment">';
        foreach ($comments as $comment) {
            $comment_post = get_post($comment->comment_post_ID);
            if (current_user_can('edit_post', $comment->comment_post_ID) || empty($comment_post->post_password) && current_user_can('read_post', $comment->comment_post_ID)) {
                _wp_dashboard_recent_comments_row($comment);
            }
        }
        echo '</ul>';
        if (current_user_can('edit_posts')) {
            echo '<h3 class="screen-reader-text">' . __('View more comments') . '</h3>';
            _get_list_table('WP_Comments_List_Table')->views();
        }
        wp_comment_reply(-1, false, 'dashboard', false);
        wp_comment_trashnotice();
        echo '</div>';
    } else {
        return false;
    }
    return true;
}

WordPress Version: 6.2

/**
 * Show Comments section.
 *
 * @since 3.8.0
 *
 * @param int $total_items Optional. Number of comments to query. Default 5.
 * @return bool False if no comments were found. True otherwise.
 */
function wp_dashboard_recent_comments($total_items = 5)
{
    // Select all comment types and filter out spam later for better query performance.
    $comments = array();
    $comments_query = array('number' => $total_items * 5, 'offset' => 0);
    if (!current_user_can('edit_posts')) {
        $comments_query['status'] = 'approve';
    }
    while (count($comments) < $total_items && $possible = get_comments($comments_query)) {
        if (!is_array($possible)) {
            break;
        }
        foreach ($possible as $comment) {
            if (!current_user_can('read_post', $comment->comment_post_ID)) {
                continue;
            }
            $comments[] = $comment;
            if (count($comments) == $total_items) {
                break 2;
            }
        }
        $comments_query['offset'] += $comments_query['number'];
        $comments_query['number'] = $total_items * 10;
    }
    if ($comments) {
        echo '<div id="latest-comments" class="activity-block table-view-list">';
        echo '<h3>' . __('Recent Comments') . '</h3>';
        echo '<ul id="the-comment-list" data-wp-lists="list:comment">';
        foreach ($comments as $comment) {
            _wp_dashboard_recent_comments_row($comment);
        }
        echo '</ul>';
        if (current_user_can('edit_posts')) {
            echo '<h3 class="screen-reader-text">' . __('View more comments') . '</h3>';
            _get_list_table('WP_Comments_List_Table')->views();
        }
        wp_comment_reply(-1, false, 'dashboard', false);
        wp_comment_trashnotice();
        echo '</div>';
    } else {
        return false;
    }
    return true;
}

WordPress Version: .12

/**
 * Show Comments section.
 *
 * @since 3.8.0
 *
 * @param int $total_items Optional. Number of comments to query. Default 5.
 * @return bool False if no comments were found. True otherwise.
 */
function wp_dashboard_recent_comments($total_items = 5)
{
    // Select all comment types and filter out spam later for better query performance.
    $comments = array();
    $comments_query = array('number' => $total_items * 5, 'offset' => 0);
    if (!current_user_can('edit_posts')) {
        $comments_query['status'] = 'approve';
    }
    while (count($comments) < $total_items && $possible = get_comments($comments_query)) {
        if (!is_array($possible)) {
            break;
        }
        foreach ($possible as $comment) {
            if (!current_user_can('read_post', $comment->comment_post_ID)) {
                continue;
            }
            $comments[] = $comment;
            if (count($comments) == $total_items) {
                break 2;
            }
        }
        $comments_query['offset'] += $comments_query['number'];
        $comments_query['number'] = $total_items * 10;
    }
    if ($comments) {
        echo '<div id="latest-comments" class="activity-block table-view-list">';
        echo '<h3>' . __('Recent Comments') . '</h3>';
        echo '<ul id="the-comment-list" data-wp-lists="list:comment">';
        foreach ($comments as $comment) {
            $comment_post = get_post($comment->comment_post_ID);
            if (current_user_can('edit_post', $comment->comment_post_ID) || empty($comment_post->post_password) && current_user_can('read_post', $comment->comment_post_ID)) {
                _wp_dashboard_recent_comments_row($comment);
            }
        }
        echo '</ul>';
        if (current_user_can('edit_posts')) {
            echo '<h3 class="screen-reader-text">' . __('View more comments') . '</h3>';
            _get_list_table('WP_Comments_List_Table')->views();
        }
        wp_comment_reply(-1, false, 'dashboard', false);
        wp_comment_trashnotice();
        echo '</div>';
    } else {
        return false;
    }
    return true;
}

WordPress Version: 5.6

/**
 * Show Comments section.
 *
 * @since 3.8.0
 *
 * @param int $total_items Optional. Number of comments to query. Default 5.
 * @return bool False if no comments were found. True otherwise.
 */
function wp_dashboard_recent_comments($total_items = 5)
{
    // Select all comment types and filter out spam later for better query performance.
    $comments = array();
    $comments_query = array('number' => $total_items * 5, 'offset' => 0);
    if (!current_user_can('edit_posts')) {
        $comments_query['status'] = 'approve';
    }
    while (count($comments) < $total_items && $possible = get_comments($comments_query)) {
        if (!is_array($possible)) {
            break;
        }
        foreach ($possible as $comment) {
            if (!current_user_can('read_post', $comment->comment_post_ID)) {
                continue;
            }
            $comments[] = $comment;
            if (count($comments) == $total_items) {
                break 2;
            }
        }
        $comments_query['offset'] += $comments_query['number'];
        $comments_query['number'] = $total_items * 10;
    }
    if ($comments) {
        echo '<div id="latest-comments" class="activity-block table-view-list">';
        echo '<h3>' . __('Recent Comments') . '</h3>';
        echo '<ul id="the-comment-list" data-wp-lists="list:comment">';
        foreach ($comments as $comment) {
            _wp_dashboard_recent_comments_row($comment);
        }
        echo '</ul>';
        if (current_user_can('edit_posts')) {
            echo '<h3 class="screen-reader-text">' . __('View more comments') . '</h3>';
            _get_list_table('WP_Comments_List_Table')->views();
        }
        wp_comment_reply(-1, false, 'dashboard', false);
        wp_comment_trashnotice();
        echo '</div>';
    } else {
        return false;
    }
    return true;
}

WordPress Version: 5.2

/**
 * Show Comments section.
 *
 * @since 3.8.0
 *
 * @param int $total_items Optional. Number of comments to query. Default 5.
 * @return bool False if no comments were found. True otherwise.
 */
function wp_dashboard_recent_comments($total_items = 5)
{
    // Select all comment types and filter out spam later for better query performance.
    $comments = array();
    $comments_query = array('number' => $total_items * 5, 'offset' => 0);
    if (!current_user_can('edit_posts')) {
        $comments_query['status'] = 'approve';
    }
    while (count($comments) < $total_items && $possible = get_comments($comments_query)) {
        if (!is_array($possible)) {
            break;
        }
        foreach ($possible as $comment) {
            if (!current_user_can('read_post', $comment->comment_post_ID)) {
                continue;
            }
            $comments[] = $comment;
            if (count($comments) == $total_items) {
                break 2;
            }
        }
        $comments_query['offset'] += $comments_query['number'];
        $comments_query['number'] = $total_items * 10;
    }
    if ($comments) {
        echo '<div id="latest-comments" class="activity-block">';
        echo '<h3>' . __('Recent Comments') . '</h3>';
        echo '<ul id="the-comment-list" data-wp-lists="list:comment">';
        foreach ($comments as $comment) {
            _wp_dashboard_recent_comments_row($comment);
        }
        echo '</ul>';
        if (current_user_can('edit_posts')) {
            echo '<h3 class="screen-reader-text">' . __('View more comments') . '</h3>';
            _get_list_table('WP_Comments_List_Table')->views();
        }
        wp_comment_reply(-1, false, 'dashboard', false);
        wp_comment_trashnotice();
        echo '</div>';
    } else {
        return false;
    }
    return true;
}

WordPress Version: .13

/**
 * Show Comments section.
 *
 * @since 3.8.0
 *
 * @param int $total_items Optional. Number of comments to query. Default 5.
 * @return bool False if no comments were found. True otherwise.
 */
function wp_dashboard_recent_comments($total_items = 5)
{
    // Select all comment types and filter out spam later for better query performance.
    $comments = array();
    $comments_query = array('number' => $total_items * 5, 'offset' => 0);
    if (!current_user_can('edit_posts')) {
        $comments_query['status'] = 'approve';
    }
    while (count($comments) < $total_items && $possible = get_comments($comments_query)) {
        if (!is_array($possible)) {
            break;
        }
        foreach ($possible as $comment) {
            if (!current_user_can('read_post', $comment->comment_post_ID)) {
                continue;
            }
            $comments[] = $comment;
            if (count($comments) == $total_items) {
                break 2;
            }
        }
        $comments_query['offset'] += $comments_query['number'];
        $comments_query['number'] = $total_items * 10;
    }
    if ($comments) {
        echo '<div id="latest-comments" class="activity-block">';
        echo '<h3>' . __('Recent Comments') . '</h3>';
        echo '<ul id="the-comment-list" data-wp-lists="list:comment">';
        foreach ($comments as $comment) {
            $comment_post = get_post($comment->comment_post_ID);
            if (current_user_can('edit_post', $comment->comment_post_ID) || empty($comment_post->post_password) && current_user_can('read_post', $comment->comment_post_ID)) {
                _wp_dashboard_recent_comments_row($comment);
            }
        }
        echo '</ul>';
        if (current_user_can('edit_posts')) {
            echo '<h3 class="screen-reader-text">' . __('View more comments') . '</h3>';
            _get_list_table('WP_Comments_List_Table')->views();
        }
        wp_comment_reply(-1, false, 'dashboard', false);
        wp_comment_trashnotice();
        echo '</div>';
    } else {
        return false;
    }
    return true;
}

WordPress Version: 4.2

/**
 * Show Comments section.
 *
 * @since 3.8.0
 *
 * @param int $total_items Optional. Number of comments to query. Default 5.
 * @return bool False if no comments were found. True otherwise.
 */
function wp_dashboard_recent_comments($total_items = 5)
{
    // Select all comment types and filter out spam later for better query performance.
    $comments = array();
    $comments_query = array('number' => $total_items * 5, 'offset' => 0);
    if (!current_user_can('edit_posts')) {
        $comments_query['status'] = 'approve';
    }
    while (count($comments) < $total_items && $possible = get_comments($comments_query)) {
        if (!is_array($possible)) {
            break;
        }
        foreach ($possible as $comment) {
            if (!current_user_can('read_post', $comment->comment_post_ID)) {
                continue;
            }
            $comments[] = $comment;
            if (count($comments) == $total_items) {
                break 2;
            }
        }
        $comments_query['offset'] += $comments_query['number'];
        $comments_query['number'] = $total_items * 10;
    }
    if ($comments) {
        echo '<div id="latest-comments" class="activity-block">';
        echo '<h3>' . __('Recent Comments') . '</h3>';
        echo '<ul id="the-comment-list" data-wp-lists="list:comment">';
        foreach ($comments as $comment) {
            _wp_dashboard_recent_comments_row($comment);
        }
        echo '</ul>';
        if (current_user_can('edit_posts')) {
            echo '<h3 class="screen-reader-text">' . __('View more comments') . '</h3>';
            _get_list_table('WP_Comments_List_Table')->views();
        }
        wp_comment_reply(-1, false, 'dashboard', false);
        wp_comment_trashnotice();
        echo '</div>';
    } else {
        return false;
    }
    return true;
}

WordPress Version: .14

/**
 * Show Comments section.
 *
 * @since 3.8.0
 *
 * @param int $total_items Optional. Number of comments to query. Default 5.
 * @return bool False if no comments were found. True otherwise.
 */
function wp_dashboard_recent_comments($total_items = 5)
{
    // Select all comment types and filter out spam later for better query performance.
    $comments = array();
    $comments_query = array('number' => $total_items * 5, 'offset' => 0);
    if (!current_user_can('edit_posts')) {
        $comments_query['status'] = 'approve';
    }
    while (count($comments) < $total_items && $possible = get_comments($comments_query)) {
        if (!is_array($possible)) {
            break;
        }
        foreach ($possible as $comment) {
            if (!current_user_can('read_post', $comment->comment_post_ID)) {
                continue;
            }
            $comments[] = $comment;
            if (count($comments) == $total_items) {
                break 2;
            }
        }
        $comments_query['offset'] += $comments_query['number'];
        $comments_query['number'] = $total_items * 10;
    }
    if ($comments) {
        echo '<div id="latest-comments" class="activity-block">';
        echo '<h3>' . __('Recent Comments') . '</h3>';
        echo '<ul id="the-comment-list" data-wp-lists="list:comment">';
        foreach ($comments as $comment) {
            $comment_post = get_post($comment->comment_post_ID);
            if (current_user_can('edit_post', $comment->comment_post_ID) || empty($comment_post->post_password) && current_user_can('read_post', $comment->comment_post_ID)) {
                _wp_dashboard_recent_comments_row($comment);
            }
        }
        echo '</ul>';
        if (current_user_can('edit_posts')) {
            echo '<h3 class="screen-reader-text">' . __('View more comments') . '</h3>';
            _get_list_table('WP_Comments_List_Table')->views();
        }
        wp_comment_reply(-1, false, 'dashboard', false);
        wp_comment_trashnotice();
        echo '</div>';
    } else {
        return false;
    }
    return true;
}

WordPress Version: 3.2

/**
 * Show Comments section.
 *
 * @since 3.8.0
 *
 * @param int $total_items Optional. Number of comments to query. Default 5.
 * @return bool False if no comments were found. True otherwise.
 */
function wp_dashboard_recent_comments($total_items = 5)
{
    // Select all comment types and filter out spam later for better query performance.
    $comments = array();
    $comments_query = array('number' => $total_items * 5, 'offset' => 0);
    if (!current_user_can('edit_posts')) {
        $comments_query['status'] = 'approve';
    }
    while (count($comments) < $total_items && $possible = get_comments($comments_query)) {
        if (!is_array($possible)) {
            break;
        }
        foreach ($possible as $comment) {
            if (!current_user_can('read_post', $comment->comment_post_ID)) {
                continue;
            }
            $comments[] = $comment;
            if (count($comments) == $total_items) {
                break 2;
            }
        }
        $comments_query['offset'] += $comments_query['number'];
        $comments_query['number'] = $total_items * 10;
    }
    if ($comments) {
        echo '<div id="latest-comments" class="activity-block">';
        echo '<h3>' . __('Recent Comments') . '</h3>';
        echo '<ul id="the-comment-list" data-wp-lists="list:comment">';
        foreach ($comments as $comment) {
            _wp_dashboard_recent_comments_row($comment);
        }
        echo '</ul>';
        if (current_user_can('edit_posts')) {
            echo '<h3 class="screen-reader-text">' . __('View more comments') . '</h3>';
            _get_list_table('WP_Comments_List_Table')->views();
        }
        wp_comment_reply(-1, false, 'dashboard', false);
        wp_comment_trashnotice();
        echo '</div>';
    } else {
        return false;
    }
    return true;
}

WordPress Version: .16

/**
 * Show Comments section.
 *
 * @since 3.8.0
 *
 * @param int $total_items Optional. Number of comments to query. Default 5.
 * @return bool False if no comments were found. True otherwise.
 */
function wp_dashboard_recent_comments($total_items = 5)
{
    // Select all comment types and filter out spam later for better query performance.
    $comments = array();
    $comments_query = array('number' => $total_items * 5, 'offset' => 0);
    if (!current_user_can('edit_posts')) {
        $comments_query['status'] = 'approve';
    }
    while (count($comments) < $total_items && $possible = get_comments($comments_query)) {
        if (!is_array($possible)) {
            break;
        }
        foreach ($possible as $comment) {
            if (!current_user_can('read_post', $comment->comment_post_ID)) {
                continue;
            }
            $comments[] = $comment;
            if (count($comments) == $total_items) {
                break 2;
            }
        }
        $comments_query['offset'] += $comments_query['number'];
        $comments_query['number'] = $total_items * 10;
    }
    if ($comments) {
        echo '<div id="latest-comments" class="activity-block">';
        echo '<h3>' . __('Recent Comments') . '</h3>';
        echo '<ul id="the-comment-list" data-wp-lists="list:comment">';
        foreach ($comments as $comment) {
            $comment_post = get_post($comment->comment_post_ID);
            if (current_user_can('edit_post', $comment->comment_post_ID) || empty($comment_post->post_password) && current_user_can('read_post', $comment->comment_post_ID)) {
                _wp_dashboard_recent_comments_row($comment);
            }
        }
        echo '</ul>';
        if (current_user_can('edit_posts')) {
            echo '<h3 class="screen-reader-text">' . __('View more comments') . '</h3>';
            _get_list_table('WP_Comments_List_Table')->views();
        }
        wp_comment_reply(-1, false, 'dashboard', false);
        wp_comment_trashnotice();
        echo '</div>';
    } else {
        return false;
    }
    return true;
}

WordPress Version: 2.3

/**
 * Show Comments section.
 *
 * @since 3.8.0
 *
 * @param int $total_items Optional. Number of comments to query. Default 5.
 * @return bool False if no comments were found. True otherwise.
 */
function wp_dashboard_recent_comments($total_items = 5)
{
    // Select all comment types and filter out spam later for better query performance.
    $comments = array();
    $comments_query = array('number' => $total_items * 5, 'offset' => 0);
    if (!current_user_can('edit_posts')) {
        $comments_query['status'] = 'approve';
    }
    while (count($comments) < $total_items && $possible = get_comments($comments_query)) {
        if (!is_array($possible)) {
            break;
        }
        foreach ($possible as $comment) {
            if (!current_user_can('read_post', $comment->comment_post_ID)) {
                continue;
            }
            $comments[] = $comment;
            if (count($comments) == $total_items) {
                break 2;
            }
        }
        $comments_query['offset'] += $comments_query['number'];
        $comments_query['number'] = $total_items * 10;
    }
    if ($comments) {
        echo '<div id="latest-comments" class="activity-block">';
        echo '<h3>' . __('Recent Comments') . '</h3>';
        echo '<ul id="the-comment-list" data-wp-lists="list:comment">';
        foreach ($comments as $comment) {
            _wp_dashboard_recent_comments_row($comment);
        }
        echo '</ul>';
        if (current_user_can('edit_posts')) {
            echo '<h3 class="screen-reader-text">' . __('View more comments') . '</h3>';
            _get_list_table('WP_Comments_List_Table')->views();
        }
        wp_comment_reply(-1, false, 'dashboard', false);
        wp_comment_trashnotice();
        echo '</div>';
    } else {
        return false;
    }
    return true;
}

WordPress Version: .20

/**
 * Show Comments section.
 *
 * @since 3.8.0
 *
 * @param int $total_items Optional. Number of comments to query. Default 5.
 * @return bool False if no comments were found. True otherwise.
 */
function wp_dashboard_recent_comments($total_items = 5)
{
    // Select all comment types and filter out spam later for better query performance.
    $comments = array();
    $comments_query = array('number' => $total_items * 5, 'offset' => 0);
    if (!current_user_can('edit_posts')) {
        $comments_query['status'] = 'approve';
    }
    while (count($comments) < $total_items && $possible = get_comments($comments_query)) {
        if (!is_array($possible)) {
            break;
        }
        foreach ($possible as $comment) {
            if (!current_user_can('read_post', $comment->comment_post_ID)) {
                continue;
            }
            $comments[] = $comment;
            if (count($comments) == $total_items) {
                break 2;
            }
        }
        $comments_query['offset'] += $comments_query['number'];
        $comments_query['number'] = $total_items * 10;
    }
    if ($comments) {
        echo '<div id="latest-comments" class="activity-block">';
        echo '<h3>' . __('Recent Comments') . '</h3>';
        echo '<ul id="the-comment-list" data-wp-lists="list:comment">';
        foreach ($comments as $comment) {
            $comment_post = get_post($comment->comment_post_ID);
            if (current_user_can('edit_post', $comment->comment_post_ID) || empty($comment_post->post_password) && current_user_can('read_post', $comment->comment_post_ID)) {
                _wp_dashboard_recent_comments_row($comment);
            }
        }
        echo '</ul>';
        if (current_user_can('edit_posts')) {
            echo '<h3 class="screen-reader-text">' . __('View more comments') . '</h3>';
            _get_list_table('WP_Comments_List_Table')->views();
        }
        wp_comment_reply(-1, false, 'dashboard', false);
        wp_comment_trashnotice();
        echo '</div>';
    } else {
        return false;
    }
    return true;
}

WordPress Version: 2.2

/**
 * Show Comments section.
 *
 * @since 3.8.0
 *
 * @param int $total_items Optional. Number of comments to query. Default 5.
 * @return bool False if no comments were found. True otherwise.
 */
function wp_dashboard_recent_comments($total_items = 5)
{
    // Select all comment types and filter out spam later for better query performance.
    $comments = array();
    $comments_query = array('number' => $total_items * 5, 'offset' => 0);
    if (!current_user_can('edit_posts')) {
        $comments_query['status'] = 'approve';
    }
    while (count($comments) < $total_items && $possible = get_comments($comments_query)) {
        if (!is_array($possible)) {
            break;
        }
        foreach ($possible as $comment) {
            if (!current_user_can('read_post', $comment->comment_post_ID)) {
                continue;
            }
            $comments[] = $comment;
            if (count($comments) == $total_items) {
                break 2;
            }
        }
        $comments_query['offset'] += $comments_query['number'];
        $comments_query['number'] = $total_items * 10;
    }
    if ($comments) {
        echo '<div id="latest-comments" class="activity-block">';
        echo '<h3>' . __('Recent Comments') . '</h3>';
        echo '<ul id="the-comment-list" data-wp-lists="list:comment">';
        foreach ($comments as $comment) {
            _wp_dashboard_recent_comments_row($comment);
        }
        echo '</ul>';
        if (current_user_can('edit_posts')) {
            echo '<h3 class="screen-reader-text">' . __('View more comments') . '</h3>';
            _get_list_table('WP_Comments_List_Table')->views();
        }
        wp_comment_reply(-1, false, 'dashboard', false);
        wp_comment_trashnotice();
        echo '</div>';
    } else {
        return false;
    }
    return true;
}

WordPress Version: .19

/**
 * Show Comments section.
 *
 * @since 3.8.0
 *
 * @param int $total_items Optional. Number of comments to query. Default 5.
 * @return bool False if no comments were found. True otherwise.
 */
function wp_dashboard_recent_comments($total_items = 5)
{
    // Select all comment types and filter out spam later for better query performance.
    $comments = array();
    $comments_query = array('number' => $total_items * 5, 'offset' => 0);
    if (!current_user_can('edit_posts')) {
        $comments_query['status'] = 'approve';
    }
    while (count($comments) < $total_items && $possible = get_comments($comments_query)) {
        if (!is_array($possible)) {
            break;
        }
        foreach ($possible as $comment) {
            if (!current_user_can('read_post', $comment->comment_post_ID)) {
                continue;
            }
            $comments[] = $comment;
            if (count($comments) == $total_items) {
                break 2;
            }
        }
        $comments_query['offset'] += $comments_query['number'];
        $comments_query['number'] = $total_items * 10;
    }
    if ($comments) {
        echo '<div id="latest-comments" class="activity-block">';
        echo '<h3>' . __('Recent Comments') . '</h3>';
        echo '<ul id="the-comment-list" data-wp-lists="list:comment">';
        foreach ($comments as $comment) {
            $comment_post = get_post($comment->comment_post_ID);
            if (current_user_can('edit_post', $comment->comment_post_ID) || empty($comment_post->post_password) && current_user_can('read_post', $comment->comment_post_ID)) {
                _wp_dashboard_recent_comments_row($comment);
            }
        }
        echo '</ul>';
        if (current_user_can('edit_posts')) {
            echo '<h3 class="screen-reader-text">' . __('View more comments') . '</h3>';
            _get_list_table('WP_Comments_List_Table')->views();
        }
        wp_comment_reply(-1, false, 'dashboard', false);
        wp_comment_trashnotice();
        echo '</div>';
    } else {
        return false;
    }
    return true;
}

WordPress Version: 1.2

/**
 * Show Comments section.
 *
 * @since 3.8.0
 *
 * @param int $total_items Optional. Number of comments to query. Default 5.
 * @return bool False if no comments were found. True otherwise.
 */
function wp_dashboard_recent_comments($total_items = 5)
{
    // Select all comment types and filter out spam later for better query performance.
    $comments = array();
    $comments_query = array('number' => $total_items * 5, 'offset' => 0);
    if (!current_user_can('edit_posts')) {
        $comments_query['status'] = 'approve';
    }
    while (count($comments) < $total_items && $possible = get_comments($comments_query)) {
        if (!is_array($possible)) {
            break;
        }
        foreach ($possible as $comment) {
            if (!current_user_can('read_post', $comment->comment_post_ID)) {
                continue;
            }
            $comments[] = $comment;
            if (count($comments) == $total_items) {
                break 2;
            }
        }
        $comments_query['offset'] += $comments_query['number'];
        $comments_query['number'] = $total_items * 10;
    }
    if ($comments) {
        echo '<div id="latest-comments" class="activity-block">';
        echo '<h3>' . __('Recent Comments') . '</h3>';
        echo '<ul id="the-comment-list" data-wp-lists="list:comment">';
        foreach ($comments as $comment) {
            _wp_dashboard_recent_comments_row($comment);
        }
        echo '</ul>';
        if (current_user_can('edit_posts')) {
            echo '<h3 class="screen-reader-text">' . __('View more comments') . '</h3>';
            _get_list_table('WP_Comments_List_Table')->views();
        }
        wp_comment_reply(-1, false, 'dashboard', false);
        wp_comment_trashnotice();
        echo '</div>';
    } else {
        return false;
    }
    return true;
}

WordPress Version: .17

/**
 * Show Comments section.
 *
 * @since 3.8.0
 *
 * @param int $total_items Optional. Number of comments to query. Default 5.
 * @return bool False if no comments were found. True otherwise.
 */
function wp_dashboard_recent_comments($total_items = 5)
{
    // Select all comment types and filter out spam later for better query performance.
    $comments = array();
    $comments_query = array('number' => $total_items * 5, 'offset' => 0);
    if (!current_user_can('edit_posts')) {
        $comments_query['status'] = 'approve';
    }
    while (count($comments) < $total_items && $possible = get_comments($comments_query)) {
        if (!is_array($possible)) {
            break;
        }
        foreach ($possible as $comment) {
            if (!current_user_can('read_post', $comment->comment_post_ID)) {
                continue;
            }
            $comments[] = $comment;
            if (count($comments) == $total_items) {
                break 2;
            }
        }
        $comments_query['offset'] += $comments_query['number'];
        $comments_query['number'] = $total_items * 10;
    }
    if ($comments) {
        echo '<div id="latest-comments" class="activity-block">';
        echo '<h3>' . __('Recent Comments') . '</h3>';
        echo '<ul id="the-comment-list" data-wp-lists="list:comment">';
        foreach ($comments as $comment) {
            $comment_post = get_post($comment->comment_post_ID);
            if (current_user_can('edit_post', $comment->comment_post_ID) || empty($comment_post->post_password) && current_user_can('read_post', $comment->comment_post_ID)) {
                _wp_dashboard_recent_comments_row($comment);
            }
        }
        echo '</ul>';
        if (current_user_can('edit_posts')) {
            echo '<h3 class="screen-reader-text">' . __('View more comments') . '</h3>';
            _get_list_table('WP_Comments_List_Table')->views();
        }
        wp_comment_reply(-1, false, 'dashboard', false);
        wp_comment_trashnotice();
        echo '</div>';
    } else {
        return false;
    }
    return true;
}

WordPress Version: 0.3

/**
 * Show Comments section.
 *
 * @since 3.8.0
 *
 * @param int $total_items Optional. Number of comments to query. Default 5.
 * @return bool False if no comments were found. True otherwise.
 */
function wp_dashboard_recent_comments($total_items = 5)
{
    // Select all comment types and filter out spam later for better query performance.
    $comments = array();
    $comments_query = array('number' => $total_items * 5, 'offset' => 0);
    if (!current_user_can('edit_posts')) {
        $comments_query['status'] = 'approve';
    }
    while (count($comments) < $total_items && $possible = get_comments($comments_query)) {
        if (!is_array($possible)) {
            break;
        }
        foreach ($possible as $comment) {
            if (!current_user_can('read_post', $comment->comment_post_ID)) {
                continue;
            }
            $comments[] = $comment;
            if (count($comments) == $total_items) {
                break 2;
            }
        }
        $comments_query['offset'] += $comments_query['number'];
        $comments_query['number'] = $total_items * 10;
    }
    if ($comments) {
        echo '<div id="latest-comments" class="activity-block">';
        echo '<h3>' . __('Recent Comments') . '</h3>';
        echo '<ul id="the-comment-list" data-wp-lists="list:comment">';
        foreach ($comments as $comment) {
            _wp_dashboard_recent_comments_row($comment);
        }
        echo '</ul>';
        if (current_user_can('edit_posts')) {
            echo '<h3 class="screen-reader-text">' . __('View more comments') . '</h3>';
            _get_list_table('WP_Comments_List_Table')->views();
        }
        wp_comment_reply(-1, false, 'dashboard', false);
        wp_comment_trashnotice();
        echo '</div>';
    } else {
        return false;
    }
    return true;
}

WordPress Version: .20

/**
 * Show Comments section.
 *
 * @since 3.8.0
 *
 * @param int $total_items Optional. Number of comments to query. Default 5.
 * @return bool False if no comments were found. True otherwise.
 */
function wp_dashboard_recent_comments($total_items = 5)
{
    // Select all comment types and filter out spam later for better query performance.
    $comments = array();
    $comments_query = array('number' => $total_items * 5, 'offset' => 0);
    if (!current_user_can('edit_posts')) {
        $comments_query['status'] = 'approve';
    }
    while (count($comments) < $total_items && $possible = get_comments($comments_query)) {
        if (!is_array($possible)) {
            break;
        }
        foreach ($possible as $comment) {
            if (!current_user_can('read_post', $comment->comment_post_ID)) {
                continue;
            }
            $comments[] = $comment;
            if (count($comments) == $total_items) {
                break 2;
            }
        }
        $comments_query['offset'] += $comments_query['number'];
        $comments_query['number'] = $total_items * 10;
    }
    if ($comments) {
        echo '<div id="latest-comments" class="activity-block">';
        echo '<h3>' . __('Recent Comments') . '</h3>';
        echo '<ul id="the-comment-list" data-wp-lists="list:comment">';
        foreach ($comments as $comment) {
            $comment_post = get_post($comment->comment_post_ID);
            if (current_user_can('edit_post', $comment->comment_post_ID) || empty($comment_post->post_password) && current_user_can('read_post', $comment->comment_post_ID)) {
                _wp_dashboard_recent_comments_row($comment);
            }
        }
        echo '</ul>';
        if (current_user_can('edit_posts')) {
            echo '<h3 class="screen-reader-text">' . __('View more comments') . '</h3>';
            _get_list_table('WP_Comments_List_Table')->views();
        }
        wp_comment_reply(-1, false, 'dashboard', false);
        wp_comment_trashnotice();
        echo '</div>';
    } else {
        return false;
    }
    return true;
}

WordPress Version: 9.3

/**
 * Show Comments section.
 *
 * @since 3.8.0
 *
 * @param int $total_items Optional. Number of comments to query. Default 5.
 * @return bool False if no comments were found. True otherwise.
 */
function wp_dashboard_recent_comments($total_items = 5)
{
    // Select all comment types and filter out spam later for better query performance.
    $comments = array();
    $comments_query = array('number' => $total_items * 5, 'offset' => 0);
    if (!current_user_can('edit_posts')) {
        $comments_query['status'] = 'approve';
    }
    while (count($comments) < $total_items && $possible = get_comments($comments_query)) {
        if (!is_array($possible)) {
            break;
        }
        foreach ($possible as $comment) {
            if (!current_user_can('read_post', $comment->comment_post_ID)) {
                continue;
            }
            $comments[] = $comment;
            if (count($comments) == $total_items) {
                break 2;
            }
        }
        $comments_query['offset'] += $comments_query['number'];
        $comments_query['number'] = $total_items * 10;
    }
    if ($comments) {
        echo '<div id="latest-comments" class="activity-block">';
        echo '<h3>' . __('Recent Comments') . '</h3>';
        echo '<ul id="the-comment-list" data-wp-lists="list:comment">';
        foreach ($comments as $comment) {
            _wp_dashboard_recent_comments_row($comment);
        }
        echo '</ul>';
        if (current_user_can('edit_posts')) {
            echo '<h3 class="screen-reader-text">' . __('View more comments') . '</h3>';
            _get_list_table('WP_Comments_List_Table')->views();
        }
        wp_comment_reply(-1, false, 'dashboard', false);
        wp_comment_trashnotice();
        echo '</div>';
    } else {
        return false;
    }
    return true;
}

WordPress Version: .24

/**
 * Show Comments section.
 *
 * @since 3.8.0
 *
 * @param int $total_items Optional. Number of comments to query. Default 5.
 * @return bool False if no comments were found. True otherwise.
 */
function wp_dashboard_recent_comments($total_items = 5)
{
    // Select all comment types and filter out spam later for better query performance.
    $comments = array();
    $comments_query = array('number' => $total_items * 5, 'offset' => 0);
    if (!current_user_can('edit_posts')) {
        $comments_query['status'] = 'approve';
    }
    while (count($comments) < $total_items && $possible = get_comments($comments_query)) {
        if (!is_array($possible)) {
            break;
        }
        foreach ($possible as $comment) {
            if (!current_user_can('read_post', $comment->comment_post_ID)) {
                continue;
            }
            $comments[] = $comment;
            if (count($comments) == $total_items) {
                break 2;
            }
        }
        $comments_query['offset'] += $comments_query['number'];
        $comments_query['number'] = $total_items * 10;
    }
    if ($comments) {
        echo '<div id="latest-comments" class="activity-block">';
        echo '<h3>' . __('Recent Comments') . '</h3>';
        echo '<ul id="the-comment-list" data-wp-lists="list:comment">';
        foreach ($comments as $comment) {
            $comment_post = get_post($comment->comment_post_ID);
            if (current_user_can('edit_post', $comment->comment_post_ID) || empty($comment_post->post_password) && current_user_can('read_post', $comment->comment_post_ID)) {
                _wp_dashboard_recent_comments_row($comment);
            }
        }
        echo '</ul>';
        if (current_user_can('edit_posts')) {
            echo '<h3 class="screen-reader-text">' . __('View more comments') . '</h3>';
            _get_list_table('WP_Comments_List_Table')->views();
        }
        wp_comment_reply(-1, false, 'dashboard', false);
        wp_comment_trashnotice();
        echo '</div>';
    } else {
        return false;
    }
    return true;
}

WordPress Version: 6.3

/**
 * Show Comments section.
 *
 * @since 3.8.0
 *
 * @param int $total_items Optional. Number of comments to query. Default 5.
 * @return bool False if no comments were found. True otherwise.
 */
function wp_dashboard_recent_comments($total_items = 5)
{
    // Select all comment types and filter out spam later for better query performance.
    $comments = array();
    $comments_query = array('number' => $total_items * 5, 'offset' => 0);
    if (!current_user_can('edit_posts')) {
        $comments_query['status'] = 'approve';
    }
    while (count($comments) < $total_items && $possible = get_comments($comments_query)) {
        if (!is_array($possible)) {
            break;
        }
        foreach ($possible as $comment) {
            if (!current_user_can('read_post', $comment->comment_post_ID)) {
                continue;
            }
            $comments[] = $comment;
            if (count($comments) == $total_items) {
                break 2;
            }
        }
        $comments_query['offset'] += $comments_query['number'];
        $comments_query['number'] = $total_items * 10;
    }
    if ($comments) {
        echo '<div id="latest-comments" class="activity-block">';
        echo '<h3>' . __('Recent Comments') . '</h3>';
        echo '<ul id="the-comment-list" data-wp-lists="list:comment">';
        foreach ($comments as $comment) {
            _wp_dashboard_recent_comments_row($comment);
        }
        echo '</ul>';
        if (current_user_can('edit_posts')) {
            echo '<h3 class="screen-reader-text">' . __('View more comments') . '</h3>';
            _get_list_table('WP_Comments_List_Table')->views();
        }
        wp_comment_reply(-1, false, 'dashboard', false);
        wp_comment_trashnotice();
        echo '</div>';
    } else {
        return false;
    }
    return true;
}

WordPress Version: .27

/**
 * Show Comments section.
 *
 * @since 3.8.0
 *
 * @param int $total_items Optional. Number of comments to query. Default 5.
 * @return bool False if no comments were found. True otherwise.
 */
function wp_dashboard_recent_comments($total_items = 5)
{
    // Select all comment types and filter out spam later for better query performance.
    $comments = array();
    $comments_query = array('number' => $total_items * 5, 'offset' => 0);
    if (!current_user_can('edit_posts')) {
        $comments_query['status'] = 'approve';
    }
    while (count($comments) < $total_items && $possible = get_comments($comments_query)) {
        if (!is_array($possible)) {
            break;
        }
        foreach ($possible as $comment) {
            if (!current_user_can('read_post', $comment->comment_post_ID)) {
                continue;
            }
            $comments[] = $comment;
            if (count($comments) == $total_items) {
                break 2;
            }
        }
        $comments_query['offset'] += $comments_query['number'];
        $comments_query['number'] = $total_items * 10;
    }
    if ($comments) {
        echo '<div id="latest-comments" class="activity-block">';
        echo '<h3>' . __('Recent Comments') . '</h3>';
        echo '<ul id="the-comment-list" data-wp-lists="list:comment">';
        foreach ($comments as $comment) {
            $comment_post = get_post($comment->comment_post_ID);
            if (current_user_can('edit_post', $comment->comment_post_ID) || empty($comment_post->post_password) && current_user_can('read_post', $comment->comment_post_ID)) {
                _wp_dashboard_recent_comments_row($comment);
            }
        }
        echo '</ul>';
        if (current_user_can('edit_posts')) {
            echo '<h3 class="screen-reader-text">' . __('View more comments') . '</h3>';
            _get_list_table('WP_Comments_List_Table')->views();
        }
        wp_comment_reply(-1, false, 'dashboard', false);
        wp_comment_trashnotice();
        echo '</div>';
    } else {
        return false;
    }
    return true;
}

WordPress Version: 5.4

/**
 * Show Comments section.
 *
 * @since 3.8.0
 *
 * @param int $total_items Optional. Number of comments to query. Default 5.
 * @return bool False if no comments were found. True otherwise.
 */
function wp_dashboard_recent_comments($total_items = 5)
{
    // Select all comment types and filter out spam later for better query performance.
    $comments = array();
    $comments_query = array('number' => $total_items * 5, 'offset' => 0);
    if (!current_user_can('edit_posts')) {
        $comments_query['status'] = 'approve';
    }
    while (count($comments) < $total_items && $possible = get_comments($comments_query)) {
        if (!is_array($possible)) {
            break;
        }
        foreach ($possible as $comment) {
            if (!current_user_can('read_post', $comment->comment_post_ID)) {
                continue;
            }
            $comments[] = $comment;
            if (count($comments) == $total_items) {
                break 2;
            }
        }
        $comments_query['offset'] += $comments_query['number'];
        $comments_query['number'] = $total_items * 10;
    }
    if ($comments) {
        echo '<div id="latest-comments" class="activity-block">';
        echo '<h3>' . __('Recent Comments') . '</h3>';
        echo '<ul id="the-comment-list" data-wp-lists="list:comment">';
        foreach ($comments as $comment) {
            _wp_dashboard_recent_comments_row($comment);
        }
        echo '</ul>';
        if (current_user_can('edit_posts')) {
            echo '<h3 class="screen-reader-text">' . __('View more comments') . '</h3>';
            _get_list_table('WP_Comments_List_Table')->views();
        }
        wp_comment_reply(-1, false, 'dashboard', false);
        wp_comment_trashnotice();
        echo '</div>';
    } else {
        return false;
    }
    return true;
}

WordPress Version: .30

/**
 * Show Comments section.
 *
 * @since 3.8.0
 *
 * @param int $total_items Optional. Number of comments to query. Default 5.
 * @return bool False if no comments were found. True otherwise.
 */
function wp_dashboard_recent_comments($total_items = 5)
{
    // Select all comment types and filter out spam later for better query performance.
    $comments = array();
    $comments_query = array('number' => $total_items * 5, 'offset' => 0);
    if (!current_user_can('edit_posts')) {
        $comments_query['status'] = 'approve';
    }
    while (count($comments) < $total_items && $possible = get_comments($comments_query)) {
        if (!is_array($possible)) {
            break;
        }
        foreach ($possible as $comment) {
            if (!current_user_can('read_post', $comment->comment_post_ID)) {
                continue;
            }
            $comments[] = $comment;
            if (count($comments) == $total_items) {
                break 2;
            }
        }
        $comments_query['offset'] += $comments_query['number'];
        $comments_query['number'] = $total_items * 10;
    }
    if ($comments) {
        echo '<div id="latest-comments" class="activity-block">';
        echo '<h3>' . __('Recent Comments') . '</h3>';
        echo '<ul id="the-comment-list" data-wp-lists="list:comment">';
        foreach ($comments as $comment) {
            $comment_post = get_post($comment->comment_post_ID);
            if (current_user_can('edit_post', $comment->comment_post_ID) || empty($comment_post->post_password) && current_user_can('read_post', $comment->comment_post_ID)) {
                _wp_dashboard_recent_comments_row($comment);
            }
        }
        echo '</ul>';
        if (current_user_can('edit_posts')) {
            echo '<h3 class="screen-reader-text">' . __('View more comments') . '</h3>';
            _get_list_table('WP_Comments_List_Table')->views();
        }
        wp_comment_reply(-1, false, 'dashboard', false);
        wp_comment_trashnotice();
        echo '</div>';
    } else {
        return false;
    }
    return true;
}

WordPress Version: 4.5

/**
 * Show Comments section.
 *
 * @since 3.8.0
 *
 * @param int $total_items Optional. Number of comments to query. Default 5.
 * @return bool False if no comments were found. True otherwise.
 */
function wp_dashboard_recent_comments($total_items = 5)
{
    // Select all comment types and filter out spam later for better query performance.
    $comments = array();
    $comments_query = array('number' => $total_items * 5, 'offset' => 0);
    if (!current_user_can('edit_posts')) {
        $comments_query['status'] = 'approve';
    }
    while (count($comments) < $total_items && $possible = get_comments($comments_query)) {
        if (!is_array($possible)) {
            break;
        }
        foreach ($possible as $comment) {
            if (!current_user_can('read_post', $comment->comment_post_ID)) {
                continue;
            }
            $comments[] = $comment;
            if (count($comments) == $total_items) {
                break 2;
            }
        }
        $comments_query['offset'] += $comments_query['number'];
        $comments_query['number'] = $total_items * 10;
    }
    if ($comments) {
        echo '<div id="latest-comments" class="activity-block">';
        echo '<h3>' . __('Recent Comments') . '</h3>';
        echo '<ul id="the-comment-list" data-wp-lists="list:comment">';
        foreach ($comments as $comment) {
            _wp_dashboard_recent_comments_row($comment);
        }
        echo '</ul>';
        if (current_user_can('edit_posts')) {
            echo '<h3 class="screen-reader-text">' . __('View more comments') . '</h3>';
            _get_list_table('WP_Comments_List_Table')->views();
        }
        wp_comment_reply(-1, false, 'dashboard', false);
        wp_comment_trashnotice();
        echo '</div>';
    } else {
        return false;
    }
    return true;
}

WordPress Version: 4.4

/**
 * Show Comments section.
 *
 * @since 3.8.0
 *
 * @param int $total_items Optional. Number of comments to query. Default 5.
 * @return bool False if no comments were found. True otherwise.
 */
function wp_dashboard_recent_comments($total_items = 5)
{
    // Select all comment types and filter out spam later for better query performance.
    $comments = array();
    $comments_query = array('number' => $total_items * 5, 'offset' => 0);
    if (!current_user_can('edit_posts')) {
        $comments_query['status'] = 'approve';
    }
    while (count($comments) < $total_items && $possible = get_comments($comments_query)) {
        if (!is_array($possible)) {
            break;
        }
        foreach ($possible as $comment) {
            if (!current_user_can('read_post', $comment->comment_post_ID)) {
                continue;
            }
            $comments[] = $comment;
            if (count($comments) == $total_items) {
                break 2;
            }
        }
        $comments_query['offset'] += $comments_query['number'];
        $comments_query['number'] = $total_items * 10;
    }
    if ($comments) {
        echo '<div id="latest-comments" class="activity-block">';
        echo '<h3>' . __('Comments') . '</h3>';
        echo '<div id="the-comment-list" data-wp-lists="list:comment">';
        foreach ($comments as $comment) {
            _wp_dashboard_recent_comments_row($comment);
        }
        echo '</div>';
        if (current_user_can('edit_posts')) {
            _get_list_table('WP_Comments_List_Table')->views();
        }
        wp_comment_reply(-1, false, 'dashboard', false);
        wp_comment_trashnotice();
        echo '</div>';
    } else {
        return false;
    }
    return true;
}

WordPress Version: .31

/**
 * Show Comments section.
 *
 * @since 3.8.0
 *
 * @param int $total_items Optional. Number of comments to query. Default 5.
 * @return bool False if no comments were found. True otherwise.
 */
function wp_dashboard_recent_comments($total_items = 5)
{
    // Select all comment types and filter out spam later for better query performance.
    $comments = array();
    $comments_query = array('number' => $total_items * 5, 'offset' => 0);
    if (!current_user_can('edit_posts')) {
        $comments_query['status'] = 'approve';
    }
    while (count($comments) < $total_items && $possible = get_comments($comments_query)) {
        if (!is_array($possible)) {
            break;
        }
        foreach ($possible as $comment) {
            if (!current_user_can('read_post', $comment->comment_post_ID)) {
                continue;
            }
            $comments[] = $comment;
            if (count($comments) == $total_items) {
                break 2;
            }
        }
        $comments_query['offset'] += $comments_query['number'];
        $comments_query['number'] = $total_items * 10;
    }
    if ($comments) {
        echo '<div id="latest-comments" class="activity-block">';
        echo '<h3>' . __('Comments') . '</h3>';
        echo '<div id="the-comment-list" data-wp-lists="list:comment">';
        foreach ($comments as $comment) {
            $comment_post = get_post($comment->comment_post_ID);
            if (current_user_can('edit_post', $comment->comment_post_ID) || empty($comment_post->post_password) && current_user_can('read_post', $comment->comment_post_ID)) {
                _wp_dashboard_recent_comments_row($comment);
            }
        }
        echo '</div>';
        if (current_user_can('edit_posts')) {
            _get_list_table('WP_Comments_List_Table')->views();
        }
        wp_comment_reply(-1, false, 'dashboard', false);
        wp_comment_trashnotice();
        echo '</div>';
    } else {
        return false;
    }
    return true;
}

WordPress Version: 4.4

/**
 * Show Comments section.
 *
 * @since 3.8.0
 *
 * @param int $total_items Optional. Number of comments to query. Default 5.
 * @return bool False if no comments were found. True otherwise.
 */
function wp_dashboard_recent_comments($total_items = 5)
{
    // Select all comment types and filter out spam later for better query performance.
    $comments = array();
    $comments_query = array('number' => $total_items * 5, 'offset' => 0);
    if (!current_user_can('edit_posts')) {
        $comments_query['status'] = 'approve';
    }
    while (count($comments) < $total_items && $possible = get_comments($comments_query)) {
        if (!is_array($possible)) {
            break;
        }
        foreach ($possible as $comment) {
            if (!current_user_can('read_post', $comment->comment_post_ID)) {
                continue;
            }
            $comments[] = $comment;
            if (count($comments) == $total_items) {
                break 2;
            }
        }
        $comments_query['offset'] += $comments_query['number'];
        $comments_query['number'] = $total_items * 10;
    }
    if ($comments) {
        echo '<div id="latest-comments" class="activity-block">';
        echo '<h3>' . __('Comments') . '</h3>';
        echo '<div id="the-comment-list" data-wp-lists="list:comment">';
        foreach ($comments as $comment) {
            _wp_dashboard_recent_comments_row($comment);
        }
        echo '</div>';
        if (current_user_can('edit_posts')) {
            _get_list_table('WP_Comments_List_Table')->views();
        }
        wp_comment_reply(-1, false, 'dashboard', false);
        wp_comment_trashnotice();
        echo '</div>';
    } else {
        return false;
    }
    return true;
}

WordPress Version: 3.4

/**
 * Show Comments section.
 *
 * @since 3.8.0
 *
 * @param int $total_items Optional. Number of comments to query. Default 5.
 * @return bool False if no comments were found. True otherwise.
 */
function wp_dashboard_recent_comments($total_items = 5)
{
    // Select all comment types and filter out spam later for better query performance.
    $comments = array();
    $comments_query = array('number' => $total_items * 5, 'offset' => 0);
    if (!current_user_can('edit_posts')) {
        $comments_query['status'] = 'approve';
    }
    while (count($comments) < $total_items && $possible = get_comments($comments_query)) {
        if (!is_array($possible)) {
            break;
        }
        foreach ($possible as $comment) {
            if (!current_user_can('read_post', $comment->comment_post_ID)) {
                continue;
            }
            $comments[] = $comment;
            if (count($comments) == $total_items) {
                break 2;
            }
        }
        $comments_query['offset'] += $comments_query['number'];
        $comments_query['number'] = $total_items * 10;
    }
    if ($comments) {
        echo '<div id="latest-comments" class="activity-block">';
        echo '<h4>' . __('Comments') . '</h4>';
        echo '<div id="the-comment-list" data-wp-lists="list:comment">';
        foreach ($comments as $comment) {
            _wp_dashboard_recent_comments_row($comment);
        }
        echo '</div>';
        if (current_user_can('edit_posts')) {
            _get_list_table('WP_Comments_List_Table')->views();
        }
        wp_comment_reply(-1, false, 'dashboard', false);
        wp_comment_trashnotice();
        echo '</div>';
    } else {
        return false;
    }
    return true;
}

WordPress Version: .32

/**
 * Show Comments section.
 *
 * @since 3.8.0
 *
 * @param int $total_items Optional. Number of comments to query. Default 5.
 * @return bool False if no comments were found. True otherwise.
 */
function wp_dashboard_recent_comments($total_items = 5)
{
    // Select all comment types and filter out spam later for better query performance.
    $comments = array();
    $comments_query = array('number' => $total_items * 5, 'offset' => 0);
    if (!current_user_can('edit_posts')) {
        $comments_query['status'] = 'approve';
    }
    while (count($comments) < $total_items && $possible = get_comments($comments_query)) {
        if (!is_array($possible)) {
            break;
        }
        foreach ($possible as $comment) {
            if (!current_user_can('read_post', $comment->comment_post_ID)) {
                continue;
            }
            $comments[] = $comment;
            if (count($comments) == $total_items) {
                break 2;
            }
        }
        $comments_query['offset'] += $comments_query['number'];
        $comments_query['number'] = $total_items * 10;
    }
    if ($comments) {
        echo '<div id="latest-comments" class="activity-block">';
        echo '<h4>' . __('Comments') . '</h4>';
        echo '<div id="the-comment-list" data-wp-lists="list:comment">';
        foreach ($comments as $comment) {
            $comment_post = get_post($comment->comment_post_ID);
            if (current_user_can('edit_post', $comment->comment_post_ID) || empty($comment_post->post_password) && current_user_can('read_post', $comment->comment_post_ID)) {
                _wp_dashboard_recent_comments_row($comment);
            }
        }
        echo '</div>';
        if (current_user_can('edit_posts')) {
            _get_list_table('WP_Comments_List_Table')->views();
        }
        wp_comment_reply(-1, false, 'dashboard', false);
        wp_comment_trashnotice();
        echo '</div>';
    } else {
        return false;
    }
    return true;
}

WordPress Version: 4.3

/**
 * Show Comments section.
 *
 * @since 3.8.0
 *
 * @param int $total_items Optional. Number of comments to query. Default 5.
 * @return bool False if no comments were found. True otherwise.
 */
function wp_dashboard_recent_comments($total_items = 5)
{
    // Select all comment types and filter out spam later for better query performance.
    $comments = array();
    $comments_query = array('number' => $total_items * 5, 'offset' => 0);
    if (!current_user_can('edit_posts')) {
        $comments_query['status'] = 'approve';
    }
    while (count($comments) < $total_items && $possible = get_comments($comments_query)) {
        if (!is_array($possible)) {
            break;
        }
        foreach ($possible as $comment) {
            if (!current_user_can('read_post', $comment->comment_post_ID)) {
                continue;
            }
            $comments[] = $comment;
            if (count($comments) == $total_items) {
                break 2;
            }
        }
        $comments_query['offset'] += $comments_query['number'];
        $comments_query['number'] = $total_items * 10;
    }
    if ($comments) {
        echo '<div id="latest-comments" class="activity-block">';
        echo '<h4>' . __('Comments') . '</h4>';
        echo '<div id="the-comment-list" data-wp-lists="list:comment">';
        foreach ($comments as $comment) {
            _wp_dashboard_recent_comments_row($comment);
        }
        echo '</div>';
        if (current_user_can('edit_posts')) {
            _get_list_table('WP_Comments_List_Table')->views();
        }
        wp_comment_reply(-1, false, 'dashboard', false);
        wp_comment_trashnotice();
        echo '</div>';
    } else {
        return false;
    }
    return true;
}

WordPress Version: 2.4

/**
 * Show Comments section.
 *
 * @since 3.8.0
 *
 * @param int $total_items Optional. Number of comments to query. Default 5.
 * @return bool False if no comments were found. True otherwise.
 */
function wp_dashboard_recent_comments($total_items = 5)
{
    // Select all comment types and filter out spam later for better query performance.
    $comments = array();
    $comments_query = array('number' => $total_items * 5, 'offset' => 0);
    if (!current_user_can('edit_posts')) {
        $comments_query['status'] = 'approve';
    }
    while (count($comments) < $total_items && $possible = get_comments($comments_query)) {
        foreach ($possible as $comment) {
            if (!current_user_can('read_post', $comment->comment_post_ID)) {
                continue;
            }
            $comments[] = $comment;
            if (count($comments) == $total_items) {
                break 2;
            }
        }
        $comments_query['offset'] += $comments_query['number'];
        $comments_query['number'] = $total_items * 10;
    }
    if ($comments) {
        echo '<div id="latest-comments" class="activity-block">';
        echo '<h4>' . __('Comments') . '</h4>';
        echo '<div id="the-comment-list" data-wp-lists="list:comment">';
        foreach ($comments as $comment) {
            _wp_dashboard_recent_comments_row($comment);
        }
        echo '</div>';
        if (current_user_can('edit_posts')) {
            _get_list_table('WP_Comments_List_Table')->views();
        }
        wp_comment_reply(-1, false, 'dashboard', false);
        wp_comment_trashnotice();
        echo '</div>';
    } else {
        return false;
    }
    return true;
}

WordPress Version: .36

/**
 * Show Comments section.
 *
 * @since 3.8.0
 *
 * @param int $total_items Optional. Number of comments to query. Default 5.
 * @return bool False if no comments were found. True otherwise.
 */
function wp_dashboard_recent_comments($total_items = 5)
{
    // Select all comment types and filter out spam later for better query performance.
    $comments = array();
    $comments_query = array('number' => $total_items * 5, 'offset' => 0);
    if (!current_user_can('edit_posts')) {
        $comments_query['status'] = 'approve';
    }
    while (count($comments) < $total_items && $possible = get_comments($comments_query)) {
        foreach ($possible as $comment) {
            if (!current_user_can('read_post', $comment->comment_post_ID)) {
                continue;
            }
            $comments[] = $comment;
            if (count($comments) == $total_items) {
                break 2;
            }
        }
        $comments_query['offset'] += $comments_query['number'];
        $comments_query['number'] = $total_items * 10;
    }
    if ($comments) {
        echo '<div id="latest-comments" class="activity-block">';
        echo '<h4>' . __('Comments') . '</h4>';
        echo '<div id="the-comment-list" data-wp-lists="list:comment">';
        foreach ($comments as $comment) {
            $comment_post = get_post($comment->comment_post_ID);
            if (current_user_can('edit_post', $comment->comment_post_ID) || empty($comment_post->post_password) && current_user_can('read_post', $comment->comment_post_ID)) {
                _wp_dashboard_recent_comments_row($comment);
            }
        }
        echo '</div>';
        if (current_user_can('edit_posts')) {
            _get_list_table('WP_Comments_List_Table')->views();
        }
        wp_comment_reply(-1, false, 'dashboard', false);
        wp_comment_trashnotice();
        echo '</div>';
    } else {
        return false;
    }
    return true;
}

WordPress Version: 1.5

/**
 * Show Comments section.
 *
 * @since 3.8.0
 *
 * @param int $total_items Optional. Number of comments to query. Default 5.
 * @return bool False if no comments were found. True otherwise.
 */
function wp_dashboard_recent_comments($total_items = 5)
{
    // Select all comment types and filter out spam later for better query performance.
    $comments = array();
    $comments_query = array('number' => $total_items * 5, 'offset' => 0);
    if (!current_user_can('edit_posts')) {
        $comments_query['status'] = 'approve';
    }
    while (count($comments) < $total_items && $possible = get_comments($comments_query)) {
        foreach ($possible as $comment) {
            if (!current_user_can('read_post', $comment->comment_post_ID)) {
                continue;
            }
            $comments[] = $comment;
            if (count($comments) == $total_items) {
                break 2;
            }
        }
        $comments_query['offset'] += $comments_query['number'];
        $comments_query['number'] = $total_items * 10;
    }
    if ($comments) {
        echo '<div id="latest-comments" class="activity-block">';
        echo '<h4>' . __('Comments') . '</h4>';
        echo '<div id="the-comment-list" data-wp-lists="list:comment">';
        foreach ($comments as $comment) {
            _wp_dashboard_recent_comments_row($comment);
        }
        echo '</div>';
        if (current_user_can('edit_posts')) {
            _get_list_table('WP_Comments_List_Table')->views();
        }
        wp_comment_reply(-1, false, 'dashboard', false);
        wp_comment_trashnotice();
        echo '</div>';
    } else {
        return false;
    }
    return true;
}

WordPress Version: .40

/**
 * Show Comments section.
 *
 * @since 3.8.0
 *
 * @param int $total_items Optional. Number of comments to query. Default 5.
 * @return bool False if no comments were found. True otherwise.
 */
function wp_dashboard_recent_comments($total_items = 5)
{
    // Select all comment types and filter out spam later for better query performance.
    $comments = array();
    $comments_query = array('number' => $total_items * 5, 'offset' => 0);
    if (!current_user_can('edit_posts')) {
        $comments_query['status'] = 'approve';
    }
    while (count($comments) < $total_items && $possible = get_comments($comments_query)) {
        foreach ($possible as $comment) {
            if (!current_user_can('read_post', $comment->comment_post_ID)) {
                continue;
            }
            $comments[] = $comment;
            if (count($comments) == $total_items) {
                break 2;
            }
        }
        $comments_query['offset'] += $comments_query['number'];
        $comments_query['number'] = $total_items * 10;
    }
    if ($comments) {
        echo '<div id="latest-comments" class="activity-block">';
        echo '<h4>' . __('Comments') . '</h4>';
        echo '<div id="the-comment-list" data-wp-lists="list:comment">';
        foreach ($comments as $comment) {
            $comment_post = get_post($comment->comment_post_ID);
            if (current_user_can('edit_post', $comment->comment_post_ID) || empty($comment_post->post_password) && current_user_can('read_post', $comment->comment_post_ID)) {
                _wp_dashboard_recent_comments_row($comment);
            }
        }
        echo '</div>';
        if (current_user_can('edit_posts')) {
            _get_list_table('WP_Comments_List_Table')->views();
        }
        wp_comment_reply(-1, false, 'dashboard', false);
        wp_comment_trashnotice();
        echo '</div>';
    } else {
        return false;
    }
    return true;
}

WordPress Version: 1.4

/**
 * Show Comments section.
 *
 * @since 3.8.0
 *
 * @param int $total_items Optional. Number of comments to query. Default 5.
 * @return bool False if no comments were found. True otherwise.
 */
function wp_dashboard_recent_comments($total_items = 5)
{
    // Select all comment types and filter out spam later for better query performance.
    $comments = array();
    $comments_query = array('number' => $total_items * 5, 'offset' => 0);
    if (!current_user_can('edit_posts')) {
        $comments_query['status'] = 'approve';
    }
    while (count($comments) < $total_items && $possible = get_comments($comments_query)) {
        foreach ($possible as $comment) {
            if (!current_user_can('read_post', $comment->comment_post_ID)) {
                continue;
            }
            $comments[] = $comment;
            if (count($comments) == $total_items) {
                break 2;
            }
        }
        $comments_query['offset'] += $comments_query['number'];
        $comments_query['number'] = $total_items * 10;
    }
    if ($comments) {
        echo '<div id="latest-comments" class="activity-block">';
        echo '<h4>' . __('Comments') . '</h4>';
        echo '<div id="the-comment-list" data-wp-lists="list:comment">';
        foreach ($comments as $comment) {
            _wp_dashboard_recent_comments_row($comment);
        }
        echo '</div>';
        if (current_user_can('edit_posts')) {
            _get_list_table('WP_Comments_List_Table')->views();
        }
        wp_comment_reply(-1, false, 'dashboard', false);
        wp_comment_trashnotice();
        echo '</div>';
    } else {
        return false;
    }
    return true;
}

WordPress Version: .39

/**
 * Show Comments section.
 *
 * @since 3.8.0
 *
 * @param int $total_items Optional. Number of comments to query. Default 5.
 * @return bool False if no comments were found. True otherwise.
 */
function wp_dashboard_recent_comments($total_items = 5)
{
    // Select all comment types and filter out spam later for better query performance.
    $comments = array();
    $comments_query = array('number' => $total_items * 5, 'offset' => 0);
    if (!current_user_can('edit_posts')) {
        $comments_query['status'] = 'approve';
    }
    while (count($comments) < $total_items && $possible = get_comments($comments_query)) {
        foreach ($possible as $comment) {
            if (!current_user_can('read_post', $comment->comment_post_ID)) {
                continue;
            }
            $comments[] = $comment;
            if (count($comments) == $total_items) {
                break 2;
            }
        }
        $comments_query['offset'] += $comments_query['number'];
        $comments_query['number'] = $total_items * 10;
    }
    if ($comments) {
        echo '<div id="latest-comments" class="activity-block">';
        echo '<h4>' . __('Comments') . '</h4>';
        echo '<div id="the-comment-list" data-wp-lists="list:comment">';
        foreach ($comments as $comment) {
            $comment_post = get_post($comment->comment_post_ID);
            if (current_user_can('edit_post', $comment->comment_post_ID) || empty($comment_post->post_password) && current_user_can('read_post', $comment->comment_post_ID)) {
                _wp_dashboard_recent_comments_row($comment);
            }
        }
        echo '</div>';
        if (current_user_can('edit_posts')) {
            _get_list_table('WP_Comments_List_Table')->views();
        }
        wp_comment_reply(-1, false, 'dashboard', false);
        wp_comment_trashnotice();
        echo '</div>';
    } else {
        return false;
    }
    return true;
}

WordPress Version: 4.0

/**
 * Show Comments section.
 *
 * @since 3.8.0
 *
 * @param int $total_items Optional. Number of comments to query. Default 5.
 * @return bool False if no comments were found. True otherwise.
 */
function wp_dashboard_recent_comments($total_items = 5)
{
    // Select all comment types and filter out spam later for better query performance.
    $comments = array();
    $comments_query = array('number' => $total_items * 5, 'offset' => 0);
    if (!current_user_can('edit_posts')) {
        $comments_query['status'] = 'approve';
    }
    while (count($comments) < $total_items && $possible = get_comments($comments_query)) {
        foreach ($possible as $comment) {
            if (!current_user_can('read_post', $comment->comment_post_ID)) {
                continue;
            }
            $comments[] = $comment;
            if (count($comments) == $total_items) {
                break 2;
            }
        }
        $comments_query['offset'] += $comments_query['number'];
        $comments_query['number'] = $total_items * 10;
    }
    if ($comments) {
        echo '<div id="latest-comments" class="activity-block">';
        echo '<h4>' . __('Comments') . '</h4>';
        echo '<div id="the-comment-list" data-wp-lists="list:comment">';
        foreach ($comments as $comment) {
            _wp_dashboard_recent_comments_row($comment);
        }
        echo '</div>';
        if (current_user_can('edit_posts')) {
            _get_list_table('WP_Comments_List_Table')->views();
        }
        wp_comment_reply(-1, false, 'dashboard', false);
        wp_comment_trashnotice();
        echo '</div>';
    } else {
        return false;
    }
    return true;
}

WordPress Version: 3.8

/**
 * Show Comments section.
 *
 * @since 3.8.0
 *
 * @param int $total_items Optional. Number of comments to query. Default 5.
 * @return bool False if no comments were found. True otherwise.
 */
function wp_dashboard_recent_comments($total_items = 5)
{
    global $wpdb;
    // Select all comment types and filter out spam later for better query performance.
    $comments = array();
    $start = 0;
    $comments_query = array('number' => $total_items * 5, 'offset' => 0);
    if (!current_user_can('edit_posts')) {
        $comments_query['status'] = 'approve';
    }
    while (count($comments) < $total_items && $possible = get_comments($comments_query)) {
        foreach ($possible as $comment) {
            if (!current_user_can('read_post', $comment->comment_post_ID)) {
                continue;
            }
            $comments[] = $comment;
            if (count($comments) == $total_items) {
                break 2;
            }
        }
        $comments_query['offset'] += $comments_query['number'];
        $comments_query['number'] = $total_items * 10;
    }
    if ($comments) {
        echo '<div id="latest-comments" class="activity-block">';
        echo '<h4>' . __('Comments') . '</h4>';
        echo '<div id="the-comment-list" data-wp-lists="list:comment">';
        foreach ($comments as $comment) {
            _wp_dashboard_recent_comments_row($comment);
        }
        echo '</div>';
        if (current_user_can('edit_posts')) {
            _get_list_table('WP_Comments_List_Table')->views();
        }
        wp_comment_reply(-1, false, 'dashboard', false);
        wp_comment_trashnotice();
        echo '</div>';
    } else {
        return false;
    }
    return true;
}

WordPress Version: 3.7

/**
 * Display recent comments dashboard widget content.
 *
 * @since 2.5.0
 */
function wp_dashboard_recent_comments()
{
    global $wpdb;
    // Select all comment types and filter out spam later for better query performance.
    $comments = array();
    $start = 0;
    $widgets = get_option('dashboard_widget_options');
    $total_items = (isset($widgets['dashboard_recent_comments']) && isset($widgets['dashboard_recent_comments']['items'])) ? absint($widgets['dashboard_recent_comments']['items']) : 5;
    $comments_query = array('number' => $total_items * 5, 'offset' => 0);
    if (!current_user_can('edit_posts')) {
        $comments_query['status'] = 'approve';
    }
    while (count($comments) < $total_items && $possible = get_comments($comments_query)) {
        foreach ($possible as $comment) {
            if (!current_user_can('read_post', $comment->comment_post_ID)) {
                continue;
            }
            $comments[] = $comment;
            if (count($comments) == $total_items) {
                break 2;
            }
        }
        $comments_query['offset'] += $comments_query['number'];
        $comments_query['number'] = $total_items * 10;
    }
    if ($comments) {
        echo '<div id="the-comment-list" data-wp-lists="list:comment">';
        foreach ($comments as $comment) {
            _wp_dashboard_recent_comments_row($comment);
        }
        echo '</div>';
        if (current_user_can('edit_posts')) {
            _get_list_table('WP_Comments_List_Table')->views();
        }
        wp_comment_reply(-1, false, 'dashboard', false);
        wp_comment_trashnotice();
    } else {
        echo '<p>' . __('No comments yet.') . '</p>';
    }
}