No permission to manage comments.'; return; } $limit = 5; $args = [ 'status' => 'hold', // = comment_approved = 0 'orderby' => 'comment_date_gmt', 'order' => 'DESC', 'number' => $limit, // no limit ]; $comments = get_comments($args); if (!$comments) { echo '
No Comments waiting for approval
'; return; } echo ''; echo ''; foreach ($comments as $comment) { $time = $comment->comment_date; $post = get_post($comment->comment_post_ID); $postName = strlen($post->post_title) > 12 ? substr($post->post_title, 0, 12) . '...' : $post->post_title; $postUrl = get_permalink($post); $content = strlen($comment->comment_content) > 100 ? substr($comment->comment_content, 0, 100) . '...' : $comment->comment_content; $commentUrl = get_edit_comment_link($comment->comment_ID); echo '' . '' . '' . ''; } echo '
LocationContent
' . esc_html($time) . '
' . esc_html($postName) . '
' . esc_html($content) . '
'; if (count($comments) >= $limit) { $url = admin_url('edit-comments.php?comment_status=moderated'); echo '
' . '
+ more
' . '
See all
' . '
'; } } }