I’m quite new to this so I might be the wrong person to answer your question but:
get_field('allowed_users')
Returns an array of user IDs so you can’t directly use in_array()
So if you change the if statement to:
if (is_array($allowed_users) && in_array($current_user_id, $allowed_users))
Hopefully it will work.
Related Posts:
- The conditional logic only works to show or hide?
- Conditional display based on ACF checkbox
- Advanced Custom Fields: how do I check to see if a value is set in an field? [closed]
- Where are custom field values stored in the database
- Advanced Custom Fields – Get custom fields from parent page
- Matching Serialized Arrays with meta_query
- How to position a custom field before the editor
- Display post_object content using Advanced Custom Fields plugin
- Remove old custom field after import
- Retrieve custom fields on Categories, using WP-API
- Order by custom field date?
- Using Custom Function With Advanced Custom Fields
- automatically set “Featured Image” the same as the og:i that is set in a custom field
- Problem with adding exta field in metabox in custom post type
- Copying Custom Meta Values from existing post to a duplicate post
- Calculate the sum of certain the_sub_fields
- Displaying Custom Fields on Post with Genesis Child Theme
- Unable to show ACF’s Image Custom Field properly in Genesis Framework [closed]
- Send Multiple Custom Field Values Through the URL
- ACF won’t load from a custom JSON location
- Show ACF fields only on certain page in the backend
- How can I pass a variable set by ACF to header.php?
- WP Custom Fields Metabox Disappears – ACF plugin issue [closed]
- Conditional custom field query
- ACF: How to get the full field name (meta_key) by a field key?
- Dynamically fill a post custom field with post publish date
- Conditionally hide or show woocommerce product variation in fontend by custom field
- How can I store a file in the database in the same way WordPress and ACF do?
- WP_User_Query pulling ACF to loop
- Print custom field in Query Loop block
- How to add Advenced Custom Fields In Single Post
- How to schedule a custom field value update?
- Order RSS content by an advanced custom field value
- Add new image block, set default class name and update it using Javascript
- Get an advanced custom field after post publish
- Advanced Custom Fields dynamic update_field
- WooCommerce – Adding Custom Fields To Invoice
- Advanced Custom Fields – display label and value only if value entered
- Specific coditional usage [closed]
- Vimeo thumbnails
- Walker class for sub-menu with ACF fields
- How to list Category list in ACF Pro’s Select Field to choose from [closed]
- Get all the posts where meta field with multiple choice has several values checked
- Querying posts by latitude and longitude to build a Google Maps with several markers
- ACF: How to get users with a ACF flexible content subfield with a specific value AND layout?
- WordPress creates new lines in postmeta table on post update
- ul list with only as many li’s as filled custom fields
- Retrive Image URL of Custom Fields in Theme
- award points to a user each time they update their cpt post
- How to Pass values to Custom Field through PHP in WordPress Posts?
- Let Users Filter Posts by Custom Fields
- Filter posts by custom field (Advanced Custom Fields)
- Advanced Custom fields not available yet during publish_page action
- How can I output the custom fields wrapping with HTML
- Displaying an ACF list of users
- ACF Plugin How to make the customer add more fields in the post?
- Custom field Search with Relavanssi
- Help with this custom field conditional if no field is set display nothing
- How to get custom image field of specific post id
- Need to search a custom field (ingredients, one long string per post), but want it to allow phrases/non-exact matches
- How To Save Data From Remote APIs To ACF?
- comments_where Hook
- ACF field group not showing in page
- What am I missing in this Code Block?
- get_field values for each post on home page using wp_add_inline_style
- Problem with revisions only returning four results
- Shortcode for Custom Field of Media Attachment (to use with Featured Images)
- Is there any way to make a custom field for a post only if the author is a certain user?
- How to use ACF with javascript to update custom field values?
- Weird custom fields data lost
- adding autosave feature to custom fields
- Retrive acf fields in publish_post action for wp_mail
- Getting user’s data, by custom field lookup (meta)
- How to delete attachments associated with custom field type when post property changes? [closed]
- ACF – Compare user and post data
- Counting number of images from loop
- Page template is missing fields or is invalid when I updating the template
- How to add content with a filter when there’s no content in the editor
- Query Posts based on custom field value
- Using ACF Custom Field value in a URL with do_shortcode() [closed]
- display Flexible Fields from options
- Display Child Page with custom fields within Parent Page
- Display different category template if custom field is checked
- How to filter post using custom feild value in shortest and longest duration?
- Query Posts Via WordPress URL
- How to Order Posts by Custom Fields?
- Fetch data from a WP page with same name as current username
- Get custom field from other post in carousel
- I want to add a custom field in the rss title of each post, but don’t want it to be shown on the site
- Create citation and url in post using 3 custom fields with conditions for each field… So close!
- Update field name without losing the value
- Advenced custom fields auto fill problem
- Adding custom field to an array
- Add image custom attribute [closed]
- How to get all specific fields from one ACF Group?
- Truncating characters in Advanced Custom Fields works some places but not others?
- acf field repeater link don’t work
- How to add an ACF only for parent term?
- Best way for managing images of ads banners
- ACF in radio button cf7