Grow your CSS skills. Land your dream job.

Last updated on:

“Edit This” Button on Posts and Pages

<?php edit_post_link(__('Edit This')); ?>

Put this in the theme file somewhere near where you output the_content() (likely in the single.php or page.php file) to make a link you can click that takes you into the admin to edit it. This link will only be visible when the viewer is logged in and has appropriate permissions to edit that page (administrator or author).

Comments

  1. TeMc
    Permalink to comment#

    Real handy thing to have in the theme.

    I’d like to add that:
    * It should, ofcourse, be used within the loop
    * And that aside from admins and post-authors, (global) ‘editors’ also see this link. Maybe obvious, but thought I’d say it here for completion.

    – Thanks to whomever sent this in :)

  2. Permalink to comment#

    Glad you found it useful! :)

    A perfect place to put is just next to the content excerpt.

  3. wow, great, thanks friend

  4. Permalink to comment#

    Thanks for sharing all this good stuff!

  5. webmaestro
    Permalink to comment#

    Thanks

  6. Good tips, but new WordPress version provides this feature by default.

  7. Permalink to comment#

    Note. If you are using in your WordPress template for localization files (*. mo, *. for).
    And since you can just:

  8. Permalink to comment#

    I’ve noticed the new WP provides this anyway. Anyone else?

  9. Thanks for the awesome little snipper. @arbtech some themes provide it but many don’t!

  10. Permalink to comment#

    Glad you found it useful! :)

    A perfect place to put is just next to the content excerpt.

  11. Permalink to comment#

    short code -> big solution…. thanks

Leave a Comment

Posting Code

  • Use Markdown, and it will escape the code for you, like `<div class="cool">`.
  • Use triple-backticks for blocks of code.
    ``` 
    <div>
      <h1>multi-line block of code</h1>
      <span>be cool yo.</span>
    </div>
    ```
  • Otherwise, escape your code, like <code>&lt;div class="cool"&gt;</code>. Markdown is just easier though.

Current ye@r *

*May or may not contain any actual "CSS" or "Tricks".