Created
March 1, 2014 17:10
-
-
Save manchumahara/9293231 to your computer and use it in GitHub Desktop.
Sometimes we need to play post edit link for admin, editor or author himself. To place the edit link on frontend it's need to take care a bit so that the edit link is not visible to any unauthorized user. So my choice is showing the edit link who has other post edit permission and the author himself.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
global $post, $current_user; | |
get_currentuserinfo(); | |
if(current_user_can( 'edit_others_posts', $post->ID ) || ($post->post_author == $current_user->ID)) { | |
//show edit link | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment