wp-content » themes » functions.php » Add an ✏️ “Edit Post” Link to WordPress Posts

Add an ✏️ “Edit Post” Link to WordPress Posts

This WordPress snippet will add an “edit page” link on the WordPress posts and pages. Only users who are logged in and have the necessary rights to edit that page will be able to see this link (administrator or author).

Add the snippet to the theme page where you want the link to appear, for example, add it next to the title in GeneratePress theme edit the single .php file and add:

<?php edit_post_link(__('Edit This')); ?>
slack prXoVh6QRn 1024x638 - Add an ✏️ “Edit Post” Link to WordPress Posts

Source: https://codex.wordpress.org/Function_Reference/edit_post_link

See also  How to delete all comments in WordPress? 🗑️💬

Was this post helpful?

Leave a Comment

I enjoy constructive responses and professional comments to my posts, and invite anyone to comment or link to my site.

Recommended