Home Forums ACF PRO Set value of ACF on user role


Set value of ACF on user role

  • Running ACF PRO on WordPress …

    I have two user types on my site, a standard user and a gold user

    I have a ACF radio field which has two options, say ‘standard’ and ‘gold’.

    What I would like to do in the backend is for standard users this radio button is set to ‘standard’ and for gold it is by default set to ‘gold’.

    I’ve set the default selection of this radio button to ‘standard’ so that sorts the standard users and what I would like to do for the gold is in my functions.php something like this

    $user_access_level = current_user_can('gold');
    if ( $user_access_level == true ){
      // I've got the user level detection working so it's next bit I'm really interested in
      'acf/name=user_radio' = gold

    Is this something that would be possible? If someone can point me in the right direction I’d be hugely grateful!


  • I am not sure where this value is shown. Is this on the user edit page ?

    If I understand correctly, I think you need to look into creating a filter with acf/load_value, which sets the value upon load.

  • Hey Bee

    This is on the post creation admin screen – so by default depending on the user thats logged in and their role different values would be selected.

    It might not be the most elegant code but I did come up with a solution for this one

    $user_access_level = current_user_can('gold');
    if ( $user_access_level == true ){
      $field['choices'] = array('standard', 'gold');
      $field['default_value'] = 1;
  • I would still recommend looking into the acf/load_value filter.

  • Been looking in to the acf/load_value filter – really helpful, thanks for recommending Beee 🙂

Viewing 5 posts - 1 through 5 (of 5 total)

The topic ‘Set value of ACF on user role’ is closed to new replies.