How To Add Edit Link in WordPress Posts, Pages and Comments

If you need to edit your WordPress posts/pages regularly or if you want to edit comments directly from the blog page, then you can consider adding Edit link to your post, page and comments template. This will save you a lot of time in managing your blog(s) because clicking on this link will take you directly to the edit page.

To add Edit link on individual posts or pages, simply place the code below, on the post and page template in your WordPress file.

<?php edit_post_link(__("Edit"), ''); ?>

Please make sure that you place the code inside the loop.

Also note that the post or page template is usually post.php and page.php respectively. However you may need to edit index.php depending upon the way your theme is coded. You can contact me if you have any doubt.

To add Edit link in individual comments, place the following code in comments loop inside the comments template file (comments.php) of your theme,

<?php edit_comment_link(__("Edit"), ''); ?>

You need not worry about your theme’s aesthetics while adding these Edit links because they will be displayed only if you are logged in with admin or editor privileges. General visitors will not see them.


Got something to say?

Wordpress installation, upgrade, plugins and theme development are my forte. If you want to spend more time blogging and less time fiddling with your templates, plugins and technical issues, I can help. Find out more about my services, then contact me.

Wordpress Tips, Tricks & Hacks!

Make Money With Wordpress!

Try Aweber for $1 Studiopress Themes

News!