Hi guys,
Is it possible to use User Field to show or hide a custom post type in the frontend? For example, user A can view post 1, 2 and 3. User B only post 1.
Can someone help me please?
Thank’s
$users = get_field('user-field-name', false, false); // get array of user IDs
if (in_array(get_current_user_id(), $users)) {
// user can view post
} else {
// user cannot view post
}