Adding an Edit Link

Sometimes when I’m reading posts that have been published already I find a typo or something else I want to change, but it is annoying having to go inside the admin area, find the post and then edit it. My previous theme had an edit link for posts and comments. Can someone tell me how to add these conveniences?

Thank you :slight_smile:

Hi Abbie,

If you are logged in into the website and then visit a post you would see a edit post link on the top, which is the admin bar. click on that and you would be taken to the edit post admin section and there you can do the editing and then update the post.

Hope it helps!!


Hi Matty- thank you for your response :slight_smile:
I am not a fan of the Admin Bar and while I can edit a post using it, I cannot edit comments.
I’m aware adding the function is relatively easy, I just need to know where to put the code I found on Wordpress Codex.

<?php edit_post_link(); ?>

Hi Abbie,

You can edit the comments too from the edit post. If you don’t see the comments section, click the screen options and tick comments for it to appear.

But as you have said you are not a fan of admin bar, so to add the edit post link go to line number 34 of file content-single.php and add the line <?php edit_post_link(); ?> right after that.

The line number 34 for me reads like below

<!-- .entry-content --></div>

Hope it helps!!


Putting the code under entry-content doesn’t work.
Putting it above <!-- .entry-meta --></div> does however.
Problem is I can’t get it to look right, you know with the spaces and slash marks like the other stuff (date, author name, comments) looks.


I am not sure why it didnt work for you.

can you share a screenshot of where you have out the code and link to your site.


You can see the screenshot here, the one which works for me

Oh wow, I didn’t even look down there.
I just assumed the edit link would appear alongside the other meta stuff at the top (date, author’s name, comments). That’s actually where I want it to be, if that’s not too much of a problem. I’d like it to appear right after the comments info.

can you share a screen shot pointing where you want it and also a link to your site.


I’d like it to appear to the right of the comment link.


Thank you :slight_smile:

To do that add the following css into the bottom of the style.css file.

.se-edit-post::before {
    color: #d6d6d6;
    content: "/";
    margin: 0 0 0 8px;
    padding: 0 6px 0 0;

and <span class="se-edit-post"><?php edit_post_link(); ?></span> to line number 17 of content-single.php file just above the line <!-- .entry-meta --></div> and below the line <?php endif; ?>

Also I hope you are making these changes using a child theme.


Yes, I have a child theme.

Do I copy content-single.php into the child theme and make the changes there or just add the above code alone to the child theme?

You previously had me copy functions.php to my child theme. (I think it was you :slight_smile: )


Yes it was me. But you dont need to copy functions.php. You just need to create a functions.php file in the child theme.

But in this case you are right, copy content-single.php to the child theme and make the changes.

To know more details about child theme, please go through this blog and codex.


Sorry for the delay.

The instructions above did not work for me. Nothing shows up at all. I did install the code correctly.

Image below

Hi Abbie,

can you please confim if you have used this code in the content-single.php of the child theme and also you have added the css to the style.css of the child theme…


I just checked the site and you have added the code in child theme’s style.css file which is wrong. copy the file itself and paste it in the child theme folder and make the edit.

Only css should be added to the child theme’s style.css…

Please remove all the php code.


Oh wow, I have a lot of work to fix. I’ve put two files into the css file so far. Oh dear.

Okay, I got it working, but “Edit This” only shows up once I click on the article. I should’ve known that given content-single.php was the file I was editing. But I’d also like it to show up on the home page. If I’m correct, I copy index.php into my child theme and look for the same code and add the code you gave me?


Yes you are right except about the file :wink:

Its not the index.php file rather it is the content.php file.


Yeah, I quickly discovered my file was all wrong. LOL

Everything is showing perfectly now :slight_smile: … except for some reason on my iPad when logged out you can see a “/” after “Leave A Comment.”

It’s an OCD thing, it’ll drive me crazy if I don’t get rid of it.

Screenshot attached

(It’s almost 4am where I am. I’ll be back later today)