HowTo – WordPress Adding An Edit Link To Your Post Pages

Filed under: Wordpress Tips

wordpress_logoWhen you are reviewing your own site sometimes you can catch an error or misspelling and you need to change it quickly.

Instead of finding the page by going into your dashboard to Posts / edit and then looking for or searching for the post you can put a link on your pages that only displays if you are logged in with Editing rights such as the Admin account.

When you click on the edit link on the page it will bring you right to the post edit page in your WordPress backend.

This is a pretty common feature but not all themes have it.

To add it to your site open your single.php file and look for the beginning of the loop.

If you don’t know the Loop in WordPress is the area of PHP code that displays the specific page to the viewer.

Look for <?php if (have_posts())

This is the beginning of the Loop.

Now look for an area you can put your Edit Link. I like to put it next to the Author Name the_author or the category links the_category for the post. Look for the code that shows this information. then add the following code.

<?php edit_post_link(‘Edit’); ?>

you can change the word Edit to meet your own needs remember to keep the single quotes though when you change it.

Now save your single.php template file and view one of your posts. You should see the Edit link so click on it and see if it works.

You can also add the Edit Link to your page.php or even your other pages that show the posts such as your category pages that use the archive.php template file.

The option is up to you but remember that you need to be logged in to see the link and your account status needs to have permission rights to edit the post.

Your normal visitors will not see the link.