Check if current user is admin

PHOTO EMBED

Fri Mar 18 2022 12:37:51 GMT+0000 (UTC)

Saved by @zildjianjaxolis #wordpress

<?php if( current_user_can('editor') || current_user_can('administrator') ) {  ?>
    // Stuff here for administrators or editors
<?php } ?>
  
  
// If you want to check more than two roles, you can check if the roles of the current user is inside an array of roles, something like:
$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 } ?>
content_copyCOPY

meta query modification

https://wordpress.stackexchange.com/questions/131814/if-the-current-user-is-an-administrator-or-editor