This morning I updated our website from Pro 4.3.3 to Pro 5.0.1 (and just before posting this, to 5.0.2).
After the update, a bunch of things were messed up. I was able to fix most of them, except this.
Inside of a Map element, under “Setup”, for “Latitude” and “Longitude” I have two custom dynamic content strings, generated by a function I snagged from a post from @alexander on Dynamic Maps. Below is the code I’m using, with two very small adjustments: “location” → “map” and “acfpro” → “acf” (neither of these changes are causing the issue):
// Get dynamic location data from event
/*
{{dc:acf:field name="map" key="lat"}}
{{dc:acf:field name="map" key="lng"}}
*/
// add a filter to supply data for {{dc:acfpro:*}} tags
add_filter( 'cs_dynamic_content_acf', function($result, $field, $args = array()) {
// supply results to {{dc:acf:field name="..."}} tags
if ( $field === 'field' && isset( $args['name'] ) ) {
// get the data for the named field
$data = get_field( $args['name'] );
if ( is_scalar( $data ) ) {
$result = $data; // If it is a string or numeric, pass it through directly
} else if ( is_array( $data ) && isset( $args['key'] ) && isset( $data[$args['key']] )) {
// If it is an array and a key argument is present, pass through the requested key
$result = $data[$args['key']];
}
}
return $result;
}, 10, 3 );
I’ve confirmed this works by including {{dc:acf:field name="map" key="lat"}}
and {{dc:acf:field name="map" key="lng"}}
in a text snippet on the same page, and it pulls the correct value. But after upgrading Pro to v5, there seems to be something wrong in how the map’s latitude and longitude are now pulling (or not pulling)
dynamic content.
I will include login creds and specific URLs to reference in a private note.