eliminate duplicate cap checks. Props coffee2code. fixes #9899

git-svn-id: https://develop.svn.wordpress.org/trunk@11426 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Ryan Boren 2009-05-21 18:55:00 +00:00
parent 2e1ed76289
commit 19c8be9a49
1 changed files with 3 additions and 8 deletions

View File

@ -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 = '<a class="post-edit-link" href="' . get_edit_post_link( $post->ID ) . '" title="' . esc_attr( __( 'Edit post' ) ) . '">' . $link . '</a>';
$link = '<a class="post-edit-link" href="' . $url . '" title="' . esc_attr( __( 'Edit post' ) ) . '">' . $link . '</a>';
echo $before . apply_filters( 'edit_post_link', $link, $post->ID ) . $after;
}