Hello,
function showUserRights() {
$user = wp_get_current_user();
$user_id = $user->ID;
// get the allowed cats from ACF
$cat_array = get_field('allowed_cats', 'user_1', false);
$cats = implode(",", $cat_arr);
return 'User ID:'.$user_id.'Array:'.$cat_array;
}
Any idea why the array is empty ? I’ve hardcoded the user_id for testing…
Best
Hi @fountain
You code looks just fine.
You need to confirm the field name is correct and also do a var_dump of the cat_array variable to ensure that the correct values are returned.
Let me know how it goes.