Created
July 5, 2017 11:38
-
-
Save ingozoell/911d7f14bf191f9df4bf9b4a050395fe to your computer and use it in GitHub Desktop.
If current user is admin or editor
https://wordpress.stackexchange.com/questions/131814/if-current-user-is-admin-or-editor
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
$user = wp_get_current_user(); | |
$allowed_roles = array('editor', 'administrator', 'author'); | |
<?php if( array_intersect($allowed_roles, $user->roles ) ) { ?> | |
//stuff here for allowed roles | |
<?php } ?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment