I have created a custom post type called Groups. I would like to provide an option to add Users to these groups in the Group edit page. Any help would be appreciated thank you. P.S: I thought of using the Post-to-Post plugin but I am not sure if that would be the right solution.
I have created a custom post type called Groups. I would like to provide an option to add Users to these groups in the Group edit page. Any help would be appreciated thank you. P.S: I thought of using the Post-to-Post plugin but I am not sure if that would be the right solution.
You can use the ACF plugin
for https://wordpress.org/plugins/advanced-custom-fields/.
Steps need to do:
Custom Fields
link at the left side menufunctions.php
file as:function acf_load_color_field_choices( $field ) { // reset choices $field['choices'] = array(); $blogusers = get_users(); $field['choices'][0] = "Select User"; foreach($blogusers as $user){ // append to choices $field['choices'][ $user->ID ] = $user->display_name; } // return the field return $field; } add_filter('acf/load_field/name=select_user_for_post', 'acf_load_color_field_choices');
Groups
post you will see users list in a dropdown as:Important details:
get user list
Dynamically populate a select field’s choices