• Hello and thanks in advance for any help, I’ve been working at this for a while. I’m using advanced custom fields to handle some meta data for my posts. I have a front-end form on my site which essentially..

    1. Gathers user input where will be later used to update ACF fields.
    2. Creates a new post.
    3. Updates those ACF fields for the new post.

    The issue I’m having is I can’t update the taxonomy type field. I have a loop in my form which loops through all the taxonomy terms and echos a checkbox input. This works fine, I’m able to get the values stored in an array. The update for the title and description fields works fine. The issue is the update just isn’t working. Here is what I have..

            $title = $_POST['title'];
            $desc = $_POST['description'];
            $excerpt = $_POST['excerpt'];
            $languages = $_POST['languages'];
    
            if(!empty($title)){
                $new_post = array(
                    'post_title' => $title,
                    'post_excerpt' => $excerpt,
                    'post_type' => 'projects',
                    'post_status' => 'publish'
                );
    
                $post_id = wp_insert_post( $new_post );
    
                // update acf fields
                $fields = array(
                    'title' => $title,
                    'desc' => $desc,
                    'languages' => $languages
                );
                update_field('title', $fields['title'], $post_id);
                update_field('description', $fields['desc'], $post_id);
                update_field('languages', $languages, $post_id);

    I’ve tried many different variations. Any help is greatly appreciated!!

  • The topic ‘ACF Help Updating Taxonomy Fields’ is closed to new replies.