Last active
August 15, 2018 22:48
-
-
Save juancamiloqhz/b595cdad40686fc958cc0288025bdbd4 to your computer and use it in GitHub Desktop.
If current user is subscriber WordPress
This file contains hidden or 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 | |
| global $current_user; // Use global | |
| get_currentuserinfo(); // Make sure global is set, if not set it. | |
| if ( ! user_can( $current_user, "subscriber" ) ) // Check user object has not got subscriber role | |
| echo 'User is a not Subscriber'; | |
| else | |
| echo 'User is a Subscriber'; | |
| ?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment