Home › Forums › Backend Issues (wp-admin) › Upgrade to use Google Maps field type › Reply To: Upgrade to use Google Maps field type
I closely read the update_field() documentation and built a template that pulls the old content into the new fields.
Looked something like this, this is inside the loop:
// switch on "show field keys", see http://www.advancedcustomfields.com/resources/update_field/
$field_key = "field_somethingrandom"; //this is the new field
$post_id = get_the_ID();
// the $address, $latitude, $longitude values come from the old fields
$value = array(
"address" => $address,
"lat" => $latitude,
"lng" => $longitude
);
update_field( $field_key, $value, $post_id );
Be sure to back up your database, this can mess up your data.
Welcome to the Advanced Custom Fields community forum.
Browse through ideas, snippets of code, questions and answers between fellow ACF users
Helping others is a great way to earn karma, gain badges and help ACF development!
ACF PRO’s Flexible Content field allows you to create smaller pieces of UI and compose them into whole flexible patterns. In our latest article, we show how to use it to create swappable site sections and integrate it all in a theme.https://t.co/ZRocH8oJSp
— Advanced Custom Fields (@wp_acf) January 24, 2023
© 2023 Advanced Custom Fields.
We use cookies to offer you a better browsing experience, analyze site traffic and personalize content. Read about how we use cookies and how you can control them in our Cookie Policy. If you continue to use this site, you consent to our use of cookies.