Trusted WordPress tutorials, when you need them most.
Beginner’s Guide to WordPress
25 Million+
Websites using our plugins
Years of WordPress experience
WordPress tutorials
by experts

How to Add an Edit Post Link to WordPress Posts and Pages

Editorial Note: We earn a commission from partner links on WPBeginner. Commissions do not affect our editors' opinions or evaluations. Learn more about Editorial Process.

Do you want to add an edit post link to your WordPress posts and pages?

An edit post link lets you easily go to the post edit screen from the front end of your site to make quick changes.

In this article, we’ll show you how you can add an edit post link to your WordPress pages and posts.

How to add an edit post link to WordPress posts and pages

Why Add an Edit Post Link to WordPress Posts and Pages?

Adding an ‘Edit Post’ link to WordPress posts and pages lets you make quick and easy changes to your content.

Instead of searching through your posts and pages in your WordPress dashboard, you can simply click the ‘Edit Post’ link on the front end of your website. This will open up the post or page editor screen directly.

example edit post link on front-end of WordPress blog post

Note: The edit post link will only be visible to users who are logged in and have the proper user role and permissions.

A lot of WordPress themes have this feature, but sometimes it’s removed by developers. If your theme doesn’t have this feature, then you’ll want to add it manually.

How to Add an Edit Post Link to WordPress Posts and Pages

To add an edit post link to WordPress, you’ll need to add code to your WordPress files.

We’ll show you 2 different methods to add the code to your site:

The first method is super easy and you don’t need to have any coding experience. But, it doesn’t work with all themes and you won’t have control over exactly where the link appears.

The second method is more technical, and you’ll need to have some knowledge of PHP so you know where to place the code. However, it will give you control over exactly where the edit link appears.

That being said, let’s show you how to add an edit post link to WordPress posts and pages.

Method 1: Add an Edit Post Link in WordPress using WPCode (Recommended)

For this method, you’ll have to add a code snippet by editing your theme’s functions.php file or using a code snippets plugin.

You can see our guide on how to paste snippets from the web into WordPress for more detailed instructions.

We’ll be using the WPCode plugin instead of editing the functions.php file.


We always recommended using WPCode because it’s free, easy to use, and won’t break your website if anything goes wrong.

To get started, you’ll need to install and activate the free WPCode plugin. You can see our guide on how to install a WordPress plugin for step-by-step instructions.

Note: The free version of WPCode has everything you need to add custom code in WordPress. However, if you want more advanced features like scheduled snippets, conversion pixels, and more, you can upgrade to WPCode Pro.

Once the plugin is activated, a new menu item labeled ‘Code Snippets’ will be added to your WordPress admin bar. When you click on it, it will show you a list of all the custom code snippets you have saved on your site. Since you’ve just installed the plugin, your list will be empty.

Go ahead and click on the ‘Add New’ button to add your code snippet.

Click the Add New Button to Add Your First Custom Code Snippet in WPCode

This will bring you to the Add Snippet page. From here, you can choose a code snippet from the built-in library or add your own custom code.

For this tutorial, navigate to the ‘Add Your Custom Code (New Snippet)’ option and click on the ‘Use snippet’ button underneath it.

Add your new custom code snippet in WPCode

Next, you’ll need to name your snippet (we called ours ‘Add edit link to single posts’) and then copy and paste the following code in the ‘Code Preview’ box:

add_action('loop_start', function () {
    if (!is_singular() || is_page() || !is_main_query()) {
}, 99);

Don’t forget to choose ‘PHP Snippet’ as the code type from the dropdown menu on the right side of the screen.

Paste code snippet in WPCode to add edit post link

Then, simply toggle the switch from ‘Inactive’ to ‘Active’ and click the ‘Save Snippet’ button at the top of the page.

Activate and save your custom code snippet

Now when you view a blog post, you should see an ‘Edit’ link at the top.

edit link added to single post

We’re using the Astra theme on our test site, and here’s where our edit link appears. It may look different on your site depending on your WordPress theme.

Method 2: Add an Edit Post Link by Manually Editing Your Theme Files

You can modify the individual theme files directly or create a child theme to override these theme files.

We recommend creating a child theme, so you don’t lose the changes you’ve made when you update your theme. For more details, see our beginner’s guide on how to create a WordPress child theme.

Whether you’re editing theme files directly, or creating a child theme, you need to copy and paste the following code and add it to your theme’s single.php, post.php, index.php, or other content template file.

<?php edit_post_link(__('{Edit}')); ?>

This code simply adds a post edit link to your WordPress posts and pages. You can change the ‘{Edit}’ text to whatever you want the link to say.

For most themes, you’ll want to add this code inside the post loop directly after the post meta data.

For example, here’s how the code would look at the end of a theme’s post meta data.

By <?php the_author_posts_link(); ?> on <?php the_time('F jS, Y'); ?>  in <?php the_category(', '); ?> <?php edit_post_link(__('{Edit}'), ''); ?>

You can also add this code to any part of your theme you want the post edit link to display. For example, you can add it to the bottom of your post content.

Once you’ve added the code and saved the file, you need to upload it to your theme directory in your WordPress hosting account.

To do this, you can use an FTP client, or the file manager option in your WordPress hosting control panel.

If you haven’t used FTP before, then you might want to check out our guide on how to use FTP to upload files to WordPress.

Now, when you’re logged into WordPress and are viewing a post or page on the front end, you can simply click the ‘Edit’ link, and you’ll be taken to the post editor screen.

Post edit link WordPress post example

We hope this article helped you learn how to add a quick edit button to WordPress posts and comments. You may also want to see our guide on how to get a free SSL certificate for your website and our expert picks of the best email marketing software for small businesses.

If you liked this article, then please subscribe to our YouTube Channel for WordPress video tutorials. You can also find us on Twitter and Facebook.

Disclosure: Our content is reader-supported. This means if you click on some of our links, then we may earn a commission. See how WPBeginner is funded, why it matters, and how you can support us. Here's our editorial process.

Editorial Staff

Editorial Staff at WPBeginner is a team of WordPress experts led by Syed Balkhi with over 16 years of experience in WordPress, Web Hosting, eCommerce, SEO, and Marketing. Started in 2009, WPBeginner is now the largest free WordPress resource site in the industry and is often referred to as the Wikipedia for WordPress.

The Ultimate WordPress Toolkit

Get FREE access to our toolkit - a collection of WordPress related products and resources that every professional should have!

Reader Interactions

15 CommentsLeave a Reply

  1. Syed Balkhi says

    Hey WPBeginner readers,
    Did you know you can win exciting prizes by commenting on WPBeginner?
    Every month, our top blog commenters will win HUGE rewards, including premium WordPress plugin licenses and cash prizes.
    You can get more details about the contest from here.
    Start sharing your thoughts below to stand a chance to win!

    • WPBeginner Support says

      That is quite strange, did your theme already include an edit link at the top of the page for one possibility?


  2. Seon Noh says

    Hi, Thank you for sharing this. one question from here, is it possible to that edit button on the post lead to a form of editing from the frontend? i want a user who generate the post to be able to update the post using this button on the post using the form, not in wordpress dashboard.

    • WPBeginner Support says

      Not at the moment, if we find a plugin with that feature that we would recommend, we will be sure to share!


  3. Josef Maria Wagner says

    Thanks, it works in posts but not in pages. My theme is Blocksy. How to enable it on pages?

  4. Tosunkaya says

    Thanks, really helped saving time. After used a new theme on one of my site, i missed this feature which exist other site’s themes, i quickly added.

  5. Tom Farrell says

    The idea of adding the Quick Edit to posts is great, but can I also add it to Links. I have a large number of links that need to be re categorised and Quick edit would be a great help.

  6. SS Kuruganti says

    I know this is an old post, but I really needed to thank you for this. You instructions were simple to follow (and understand) and solved my problem perfectly! =)

Leave A Reply

Thanks for choosing to leave a comment. Please keep in mind that all comments are moderated according to our comment policy, and your email address will NOT be published. Please Do NOT use keywords in the name field. Let's have a personal and meaningful conversation.