eliminate duplicate cap checks. Props coffee2code. fixes #9899
git-svn-id: http://svn.automattic.com/wordpress/trunk@11426 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
e6c673e76c
commit
54998219dc
|
@ -724,15 +724,10 @@ function edit_post_link( $link = 'Edit This', $before = '', $after = '', $id = 0
|
||||||
if ( !$post = &get_post( $id ) )
|
if ( !$post = &get_post( $id ) )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if ( $post->post_type == 'page' ) {
|
if ( !$url = get_edit_post_link( $post->ID ) )
|
||||||
if ( !current_user_can( 'edit_page', $post->ID ) )
|
return;
|
||||||
return;
|
|
||||||
} else {
|
|
||||||
if ( !current_user_can( 'edit_post', $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;
|
echo $before . apply_filters( 'edit_post_link', $link, $post->ID ) . $after;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue