How to Add ‘Edit All Comments’ Link to WordPress Posts

How do you edit all 100 comments on your WordPress posts? Probably you go to the WordPress Admin to find the post, then see the number of comments beside the post, then click it to see the screen to edit all the comments on the posts. Or you click the single Edit link beside each comment individually.

Just as front end editing makes editing faster – would it not be easier if there was a link which would take WordPress admin/editors directly from the web page to the ALL comments moderation screen. We added this code is our WordPress theme which allows logged in admins to reach the comment moderation links in one click!

Edit All Comments

Traditionally you need to go to WordPress admin > All Post > Post > Comments Count Link.

comments count

Clicking on the comments takes you to the ALL Comments Edit Screen, where you can moderate comments quickly and deal with spam comments faster.

comments edit screen

Edit All Comments Link

I wanted to share a screenshot of what I see when I view the post.

edit comments link

Normal site visitors will not see those 2 buttons to ‘Edit Current Post’ and ‘Edit All Comments’ – it is only visible to logged in Admins on our site.

Here is the code we use

if (is_user_logged_in() || current_user_can('edit_post')) { 

<a  href="<?php the_ID(); ?>&amp;action=edit">Edit Current Post</a>

<a href="<?php the_ID(); ?>" target="_blank">Edit All Comments</a>

<?php } ?>

The first line checks to see the user is logged in and has rights to edit the post. Then next is the Edit Post button which you probably already have in your theme at some place. The next code adds the ‘Edit All Comments” link.

Where to add the code? You can add it to the single.php or content.php file, depending of your WordPress theme, where you want the code to appear.

How did we make those cool buttons? They are made easily with Bootstrap theme and Font Awesome – both essential elements of modern web design.

Share with friends

Leave a Reply

Leave a Reply

newest oldest most voted
Notify of
Ryan Biddulph
Ryan Biddulph

Nice option P which saves us a bunch of time. Thanks!

Abhishek Mishra
Abhishek Mishra

Hello dude, what code or plugins you’re using, incredible load speed of ur site?

Akshat Verma
Akshat Verma

Very handy and saves my time editing comments. Thanks for this tutorial.

Sasikumar Krishnan
Sasikumar Krishnan

Really helpful post for wordpress users. Thanks a lot for sharing.

Fahim Zada
Fahim Zada

It’s help me thankx for the post thumbs up for writer i will keep visiting for new staff great web :)