X

Add Edit button on posts and pages

Many times Ill be working on a large site like wpsnipp and you see a problem with a post or a page and you want to quickly make changes. This WordPress function will add an edit link directly to the post within the admin page so you can do just that.

 
    edit_post_link(__('Edit'));

If you are using a plugin like W3TC or other caching plugins when you add the above code to your theme it will not show or hide based on the user. So in order to make it work you need to use something called fragment caching. Rather than the above snippet add the following to your theme and you will have the best of both worlds.

<!-- mfunc edit_post_link(__('Edit')); --><!-- /mfunc -->

Comments  Leave a Reply

Add a Comment

We're glad you have chosen to leave a comment. Please keep in mind that all comments are moderated according to our privacy policy, and all links are nofollow. Do NOT use keywords in the name field. Let's have a personal and meaningful conversation.

WordPress Launch Checklist

The Ultimate WordPress Launch Checklist

We've compiled all the essential checklist items for your next WordPress website launch into one handy ebook.
Yes, Send Me the Free eBook!