If you are logged-in and switch to the front-end the default Wordpress theme Twenty Eleven provides edit buttons next to every post.

Pressing this button you get to the certain post's back-end post edit page.

How to implement this into a custom template?


The function is edit_post_link() (see Codex or source). In TwentyEleven it used as follows in content.php

edit_post_link( __( 'Edit', 'twentyeleven' ), '<span class="edit-link">', '</span>' );

You can simply use the function as indicated above (or in the Codex) in a custom template, but it must be used inside the loop. There's no need to perform any permission checks.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.