Home › Forums › General Issues › Sort User Select field output › Reply To: Sort User Select field output
I can’t give you a complete answer but I might get you started. In addition to getting the field with
$related_users = get_field('related_users',get_the_ID());
$user_order = get_post_meta($post->ID, 'related_users', true);
This should return an array of user IDs in the order that they are selected. Then you might be able to sort the users in the correct order.
Another option is to simply get the user IDs array as I mentioned above, loop over that and get the information yourself using WP functions instead of depending on ACF. https://developer.wordpress.org/reference/functions/get_userdata/
Welcome to the Advanced Custom Fields community forum.
Browse through ideas, snippets of code, questions and answers between fellow ACF users
Helping others is a great way to earn karma, gain badges and help ACF development!
Plugin boilerplates can do some of the heavy lifting during initial development. We look at four options to speed up your plugin creation. https://t.co/ZtMsdBxAHw— Advanced Custom Fields (@wp_acf) June 5, 2023
© 2023 Advanced Custom Fields.