This problem is fixed. You don't need to use this method method.


Is the Google Maps shortcode not working on your site anymore? Is something like this popping up:




Google recently changed the way that Google Maps works. Since June 22 2016 they do not allow map requests without an API key, so that's why the maps stopped working.

How to fix this?


 

  1. Create a new application in Google Account and get the API key.
  2. Add in {theme}/functions.php  file

 

/**
 * Dequeue default google maps option type script wich doesn't have API key
 * and enqueue one with an API key
 */
function _action_theme_replace_gmaps_script() {
    $handle = 'google-maps-api-v3';

    if (!wp_script_is($handle)) {
        return;
    }

    // https://github.com/ThemeFuse/Unyson/blob/v2.5.6/framework/includes/option-types/map/class-fw-option-type-map.php#L32-L38
    {
        wp_dequeue_script($handle);
        wp_deregister_script($handle);
    }

    wp_enqueue_script(
        $handle,
        'https://maps.googleapis.com/maps/api/js?'. http_build_query(array(
            'v' => '3.15',
            'libraries' => 'places',
            'language' => substr( get_locale(), 0, 2 ),
            'key' => 'YOUR_KEY'
        )),
        array(),
        fw()->manifest->get_version(),
        true
    );
}

function _action_theme_fw_init() {
    // https://github.com/ThemeFuse/Unyson-PageBuilder-Extension/commit/a780e1789e6ff454e3382ac71dd98c78b7844037
    if (version_compare(fw_ext('page-builder')->manifest->get_version(), '1.5.6', '>=')) {
        add_action('admin_enqueue_scripts', '_action_theme_replace_gmaps_script', 20);
    } else {
        add_action('admin_print_scripts', '_action_theme_replace_gmaps_script', 20);
    }
}

add_action('fw_init', '_action_theme_fw_init');