get edit post link

You are here:

Description

Returns edit post url as string value, provided the current user has the ‘edit_post’ capability. To retrieve a URL without checking user capabilities use admin_url() instead.

Can be used within the WordPress loop or outside of it. Can be used with pages, posts, attachments, and revisions.

Usage


 <?php echo get_edit_post_link( $id, $context ); ?> 

Parameters

id
(integer) (optional) The post ID

Default: None
context
(string) (optional) How to write ampersands. Defaults to ‘display’ which will encode as ‘&amp;’. Passing any other string (including an empty string), will encode ampersands as ‘&’.

Default: ‘display’

Return

admin_url() (string) 
admin_url() to edit the post or post_type.

Changelog

  • Since: 2.3.0

Source File

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

Related

Edit Link: edit_post_link(), edit_comment_link(), edit_tag_link(), edit_bookmark_link()

  • get_delete_post_link()
See also index of Function Reference and index of Template Tags.
Was this article helpful?
Dislike 0
Views: 6