Support

Account

Forum Replies Created

  • i have put this code inside the form tag

    <p class="input_container">
                            <label for="related_study_paths"><?php _e('Related Study Paths'); ?></label>
                            <?php
                            // Retrieve the current user's selected study paths
                            $selected_study_paths = get_field('related_study_paths', 'user_' . get_current_user_id());
    
                            // Render the ACF Relationship field choices
                            acf_form(array(
                                'post_id' => 'user_' . get_current_user_id(),
                                'post_title' => false,
                                'form' => false,
                                'field_groups' => array('group_XXXXXXXXX'), // Replace with your field group key
                                'fields' => array('related_study_paths'), // Replace with your field name
                                'return' => false,
                                'submit_value' => false,
                                'values' => array('related_study_paths' => $selected_study_paths), // Pass the selected choices
                            ));
    
                            if ($selected_study_paths) {
                                echo '<ul>';
                                foreach ($selected_study_paths as $study_path) {
                                    echo '<li>' . get_the_title($study_path) . '</li>';
                                }
                                echo '</ul>';
                            }
                            ?>
                        </p> 

    It does output a form field with a search bar but it does not have anything inside it to select from.

  • Hi, yea I have tried that and it works in displaying the dropdown, but the saving doesn’t happen in wp_usermeta.

    I added the ACF form location to the default WordPress Register page and it works, it saves the related study path for the default ‘student’ user. I just want the same form on my custom registration form because I am not using the default WordPress registration.

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