Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #162182

    Hi,
    revision is not working unless i saw differences between versions, when I restore an older version nothing happen.

    Could you help ?

    #162264

    Hi,
    I think I found a solution for the revisions issue and we’ll fix this in the next update (Enfold 2.2). For a quick fix add following code to the bottom of functions.php

    
    add_action('wp_restore_post_revision',  'avia_builder_restore_revision', 10, 2);
    
            function avia_builder_restore_revision( $post_id, $revision_id )
            {
                //$post     = get_post($post_id);
                $revision = get_post($revision_id);
                $meta_fields = array('_aviaLayoutBuilderCleanData', '_avia_builder_shortcode_tree');
    
                foreach($meta_fields as $meta_field)
                {
                    $builder_meta_data  = get_metadata( 'post', $revision->ID, $meta_field, true );
    
                    if (!empty($builder_meta_data))
                    {
                        update_post_meta($post_id, $meta_field, $builder_meta_data);
                    }
                    else
                    {
                        delete_post_meta($post_id, $meta_field);
                    }
                }
            }
    
    
Viewing 2 posts - 1 through 2 (of 2 total)
  • The topic ‘Revision not Works’ is closed to new replies.