WordPress.org

Support

Support » How-To and Troubleshooting » WordPress breaks script URLs that contains &

WordPress breaks script URLs that contains &

  • I’m trying to use the Google MAP API.
    The URL to use the Javascript library is:
    http://maps.googleapis.com/maps/api/js?v=3.4&key=<your_API_key>&sensor=false

    However, when I try to enqueue this:

    // enforce google map API presence
    function put_googlemaps_in_trouwlocatie () {
    		wp_enqueue_script( 'googlemaps', 'http://maps.googleapis.com/maps/api/js?v=3.4&key=<your_API_key>&sensor=false' );
    }
    
    add_action('init', 'put_googlemaps_in_trouwlocatie');

    The URL gets mangled because all (ampersand)s get replaced by (ampersand)#038;

    How can I enqueue this script without breaking the URL?
    I have tried this while all other plugins were disabled. I’m at a loss here.

  • The topic ‘WordPress breaks script URLs that contains &’ is closed to new replies.
Skip to toolbar