Create array of roles selected
-
Hello guys!
I know this is a very simple question, but I’m not able to know how to create an array of user roles selected.
I’m using the User Role field for been chosen in a page.
With this values I’ll allow current user to see the page content.Here is my code:
// Store the ACF "Role" info
$roles = get_field('iuser_role');if($roles) {
// Create an array of users that will be able to access the page from the ACF "User" field
$roles_that_can_access_this_post = array();
foreach($roles as $role) {
$roles_IDs_that_can_access_this_post[] = $role;
}Thanks!!
Viewing 3 replies - 1 through 3 (of 3 total)
Viewing 3 replies - 1 through 3 (of 3 total)
- The topic ‘Create array of roles selected’ is closed to new replies.