Created
October 16, 2019 17:20
-
-
Save Pross/0509ac39f485c66ae0c8394bb93db2ee to your computer and use it in GitHub Desktop.
Current usewr
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
<?php // ADDED FOR CODE HIGHLIGHTING | |
add_shortcode( 'current_role', function() { | |
global $wp_roles; | |
$current_user = wp_get_current_user(); | |
$role = array_shift( $current_user->roles ); | |
return isset( $wp_roles->role_names[ $role ] ) ? translate_user_role( $wp_roles->role_names[ $role ] ) : false; | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment