Add post ID arg to edit_post_link(). Props coffee2code. fixes #9898

git-svn-id: http://svn.automattic.com/wordpress/trunk@11425 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
ryan 2009-05-21 18:43:04 +00:00
parent 1a939b81bd
commit e6c673e76c
1 changed files with 5 additions and 3 deletions

View File

@ -711,16 +711,18 @@ function get_edit_post_link( $id = 0, $context = 'display' ) {
}
/**
* Retrieve edit posts link for post.
* Display edit post link for post.
*
* @since 1.0.0
*
* @param string $link Optional. Anchor text.
* @param string $before Optional. Display before edit link.
* @param string $after Optional. Display after edit link.
* @param int $id Optional. Post ID.
*/
function edit_post_link( $link = 'Edit This', $before = '', $after = '' ) {
global $post;
function edit_post_link( $link = 'Edit This', $before = '', $after = '', $id = 0 ) {
if ( !$post = &get_post( $id ) )
return;
if ( $post->post_type == 'page' ) {
if ( !current_user_can( 'edit_page', $post->ID ) )