Support

Account

Home Forums General Issues ACF Front End Form Revisions Reply To: ACF Front End Form Revisions

  • Hi!

    So I’m encountering the exact same problem.

    I add all the meta fields to _wp_post_revision_fields

    
    add_filter('_wp_post_revision_fields', function ($fields, $post) {
        if ($post && $post['post_type'] === 'visit') {
            $json = TEMPLATEPATH.'/acf-json/group_5b311d2d73933.json';
    
            if (is_file($json)) {
                $visits_fields = json_decode(file_get_contents($json));
    
                if (is_array($visits_fields) && $visits_fields->fields) {
                    foreach ($visits_fields->fields as $field) {
                        if ($field->name) {
                            $fields[$field->name] = $field->label;
                        }
                    }
                }
            }
        }
    
        return $fields;
    }, 10, 2);
    

    Everything works as expected on the admin side, but when updating “visit” from the fontend – a revision is created, but no “change”.

    When I edit post from backend then revision is also created but shows all the custom fields also which were added via the filter.

    I don’t use the acf_form on frontend. Just a simple custom form and wp_insert/update_post and update_field(“<hash>”, value); functions.