Codex

Template Tags/edit post link

Contents

Description

Displays a link to edit the current post, if a user is logged in and allowed to edit the post. It must be within The Loop.

Usage

 <?php edit_post_link$link$before$after ); ?> 

Parameters

$link
(string) (optional) The link text.
Default: 'Edit This'
$before
(string) (optional) Text to put before the link text.
Default: None
$after
(string) (optional) Text to put after the link text.
Default: None

Examples

Default Usage

Displays edit post link using defaults.

<?php edit_post_link(); ?>

Display Edit in Paragraph Tag

Displays edit post link, with link text "edit", in a paragraph (<p>) tag.

<?php edit_post_link('edit', '<p>', '</p>'); ?>

Change Log

Since: 1.0.0

Source File

edit_post_link() is located in wp-includes/link-template.php.

Related

edit_post_link, edit_comment_link, edit_tag_link, edit_bookmark_link

See also index of Function Reference and index of Template Tags.