From 19c8be9a498139b9e34ffb2c30d4b28fa7e7c08d Mon Sep 17 00:00:00 2001 From: Ryan Boren Date: Thu, 21 May 2009 18:55:00 +0000 Subject: [PATCH] eliminate duplicate cap checks. Props coffee2code. fixes #9899 git-svn-id: https://develop.svn.wordpress.org/trunk@11426 602fd350-edb4-49c9-b593-d223f7449a82 --- wp-includes/link-template.php | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/wp-includes/link-template.php b/wp-includes/link-template.php index 8660b0cbef..4e5cd8aa71 100644 --- a/wp-includes/link-template.php +++ b/wp-includes/link-template.php @@ -724,15 +724,10 @@ 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 ) ) - return; - } else { - if ( !current_user_can( 'edit_post', $post->ID ) ) - return; - } + if ( !$url = get_edit_post_link( $post->ID ) ) + return; - $link = '' . $link . ''; + $link = '' . $link . ''; echo $before . apply_filters( 'edit_post_link', $link, $post->ID ) . $after; }