edit_post_link() performs redundant permissions checking
|Reported by:||coffee2code||Owned by:|
edit_post_link() duplicates permission checks that are already (and always) performed in get_edit_post_link().
edit_post_link() has checks to ensure current_user_can('edit_post', $post->ID) (and similar if it's a page). If the user can, then get_edit_post_link() is called, which repeats those checks.
The attached patch has edit_post_link() defer to get_edit_post_link() for the check. This eliminates code duplication and redundant processing, centralizes this permission checking, and removes lines of code; wins all around.
Patch is also compatible with changes I suggested in #9898.