Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Support Patrick – WPMU DEV Support

    (@wpmudevsupport12)

    Hi @jeppner

    I hope you are doing well.

    I made a couple of checks and the issue is how the field is being saved in the database, it is serialized data, which should be the default behaviour from WP when you save the post meta.

    In this case you will need to use a custom hook to grab the data from submission and update it, a small starting code:

    <?php
    
    add_action('forminator_post_data_field_post_saved', function ($post_id, $field, $data,) {
    
        // grab the field data
        $street = ($_POST['address-1-street_address']) ? $_POST['address-1-street_address'] : '';
    
        // build your array it needs to match a:5:{s:7:”street1″;s:13:”123 Main”;s:4:”city”;s:9:”Vancouver”;s:5:”state”;s:16:”British Columbia”;s:3:”zip”;s:7:”V5V 3E4″;s:7:”country”;s:6:”Canada”;}
        $address = [
            'street' => $street,
        ];
    
        // update the post meta
        update_post_meta($post_id, 'your_acf_field_key', $address);
    }, 10, 3);

    To find out more about serialized value
    https://wordpress.stackexchange.com/questions/290189/inserting-serialized-value-into-wp-postmeta-using-update-post-meta

    Best Regards
    Patrick Freitas

    Thread Starter Jess

    (@jeppner)

    Thank you Patrick, you’re seriously amazing! Thanks so much, super appreciated!

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘ACF Address Field Mapping’ is closed to new replies.