Home Forums Front-end Issues Updating user post object field on front-end


Updating user post object field on front-end

  • I have a user directory section where i am querying users on the front-end of my site. I wanted to add a taxonomy to users so they can assign themself ‘skills’ which could then be used as a filter to find users in searches etc.

    So instead i set up a custom post type of skills and then an ACF Post Object which is assigned to the User Form.

    That works fine, however i know need to allow the user to update that field and select multiple ‘skills’ to assign to them. I have my custom form which is updating all my fields and other ACF fields, but am unsure how to go about this field.

    Below is what i have to display the skills in a multiselect but im not sure how to update this field?

    <?php $post_type = 'skills';
    $post_type_object = get_post_type_object($post_type);
    $label = $post_type_object->label;
    $posts = get_posts(array('post_type'=> $post_type, 'post_status'=> 'publish'));
    echo '<select multiple="multiple" data-plugin="select2" name="skills" id="skills">';
    echo '<option value = "" >All '.$label.' </option>';
         foreach ($posts as $post) {
             echo '<option value="', $post->ID, '"', $selected == $post->ID ? ' selected="selected"' : '', '>', $post->post_title, '</option>';
    echo '</select>';
Viewing 1 post (of 1 total)

The topic ‘Updating user post object field on front-end’ is closed to new replies.