From 2e1ed76289e17ebeb75fc84fa5c075dbea002075 Mon Sep 17 00:00:00 2001 From: Ryan Boren Date: Thu, 21 May 2009 18:43:04 +0000 Subject: [PATCH] Add post ID arg to edit_post_link(). Props coffee2code. fixes #9898 git-svn-id: https://develop.svn.wordpress.org/trunk@11425 602fd350-edb4-49c9-b593-d223f7449a82 --- wp-includes/link-template.php | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/wp-includes/link-template.php b/wp-includes/link-template.php index 9cf183d09d..8660b0cbef 100644 --- a/wp-includes/link-template.php +++ b/wp-includes/link-template.php @@ -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 ) )