AgentWP

  • Tutorials
  • Themes
  • Plugins
  • Services
  • Contact

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

If you need to edit your WordPress posts/pages frequently or if you want to edit comments directly from the blog page, then you might consider adding Edit link to your post, page and comments template. This is one of the best WordPress management productivity tip as you can simply click on the edit link and go to the respective edit screen for post, page or comment. This will save you a lot of time in managing your WordPress website(s).

edit link wordpress posts pages comments

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(); ?>

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 WordPress theme is coded. You can see WordPress template hierarchy to find out the correct template file to edit.

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(); ?>

That’s it. You also 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.

Get useful WordPress related tricks, tips, tutorials and reviews delivered straight to your inbox.

StudioPress - Premium Wordpress Themes
ElegantThemes - Premium Wordpress Themes

Copyright © 2022 · AGENTWP · All Rights Reserved

Copyright © 2022 · awp on Genesis Framework · WordPress · Log in