This isn’t working for me.
I changed the variable to $userCurrent instead of $user (I have some other API coding that uses $user.
I have this:
function user_role_can_see_this() {
// Which Roles
$which_roles = array(
'administrator'.
'associate_member'.
'full_member'
);
$userCurrent = wp_get_current_user();
return in_array( $which_roles, (array) $userCurrent->roles );
}
and then on the section (it’s a section and a module within) that I want to display I have this:
user_role_can_see_this()
It’s not showing up when I’m logged in with an administrator level account.
I tried logging in with a user that has both of the other roles, and it hasn’t worked on those either.
I have the latest version of WP and Divi installed.
-
This reply was modified 5 years, 6 months ago by
Wow Digital.