Hello, I have created a select field with custom values in ACF for users.
I have added few values as:
0 : Red
1 : Green
2 : Blue
How I can print all those options with selected value?
I’m not sure what you are trying to do and you may need to supply more details.
If you are just trying to use get_field_object(), the best way to do this is to use the field key
$field_object = get_field_object('field_01234abcd');
If you want to get the values from this user then you need to supply the correct $post_id value for the user. The $post_id value you need is created something like this
$post_id = 'user_'.$current_user_id; // <= you will need to get the current user id
then to get the values
$values = get_field('your-field-name-here', $post_id);
Let me explain you. I will record a video.
This reply has been marked as private.
Please see my previous answer. You use get_field_object() using the field key, the choices are part of the field object. You use get_field() and include the correct $post_id value to get the selected values from the user https://www.advancedcustomfields.com/resources/how-to-get-values-from-a-user/
Have you checked the video that I send to you? I use the same sting as in the docs and it doenst work on the video.