Title: WP Localize Script
Last modified: April 5, 2017

---

# WP Localize Script

 *  [Davide Prevosto](https://wordpress.org/support/users/daweb/)
 * (@daweb)
 * [9 years, 1 month ago](https://wordpress.org/support/topic/wp-localize-script/)
 * Hi Frank,
 * how are you?
 * We are including all the “inline js code” in our autoptimized js file.
 * In our scripts, we have:
 * wp_localize_script($this->places_gmaps, ‘places_gmaps’, $places_gmaps_settings);
 * It includes dinamyc params, I mean the lat/lng coordinates, for multiple pages…
   so we would like to EXCLUDE just this inline snippet and we need to “echo” it
   AFTER your autoptimize JS file. Is it possible?
 * Hope I was clear, I am sorry.
 * [@futtta](https://wordpress.org/support/users/futtta/)
    -  This topic was modified 9 years, 1 month ago by [Davide Prevosto](https://wordpress.org/support/users/daweb/).

Viewing 5 replies - 1 through 5 (of 5 total)

 *  Plugin Author [Frank Goossens](https://wordpress.org/support/users/futtta/)
 * (@futtta)
 * [9 years, 1 month ago](https://wordpress.org/support/topic/wp-localize-script/#post-8997816)
 * I’m fine, thanks you [@daweb](https://wordpress.org/support/users/daweb/) 🙂
 * assuming the localized JS has `places_gmaps` in the inlined JS, you could use
   that string to exclude?
 *  Thread Starter [Davide Prevosto](https://wordpress.org/support/users/daweb/)
 * (@daweb)
 * [9 years, 1 month ago](https://wordpress.org/support/topic/wp-localize-script/#post-9004689)
 * May you remember me how to exclude it using `places_gmaps`?
 *  Plugin Author [Frank Goossens](https://wordpress.org/support/users/futtta/)
 * (@futtta)
 * [9 years, 1 month ago](https://wordpress.org/support/topic/wp-localize-script/#post-9004770)
 * Sure; add that string to the comma-separated “Exclude scripts from Autoptimize”-
   field.
 *  Thread Starter [Davide Prevosto](https://wordpress.org/support/users/daweb/)
 * (@daweb)
 * [9 years, 1 month ago](https://wordpress.org/support/topic/wp-localize-script/#post-9013781)
 * Thank you Frank. And how to append this snippet AFTER the minification?
    Is it
   possible? I need jQuery, and it is minified into the autoptimize js. I wouldn’t
   remove it from minification.
 *  Plugin Author [Frank Goossens](https://wordpress.org/support/users/futtta/)
 * (@futtta)
 * [9 years, 1 month ago](https://wordpress.org/support/topic/wp-localize-script/#post-9014220)
 * well, you can instruct AO to inject the JS elsewhere using the API (see [autoptimize_helper.php_example](http://plugins.svn.wordpress.org/autoptimize/trunk/autoptimize_helper.php_example)
   for an example of how to use the `autoptimize_filter_js_replacetag` filter), 
   so you can change that.
 * but normally wp_localize_script just outputs the JS object and that object is
   used by a normally enqueued script which can be optimized, in which case you 
   would not need to juggle with the JS injection point to begin with?

Viewing 5 replies - 1 through 5 (of 5 total)

The topic ‘WP Localize Script’ is closed to new replies.

 * ![](https://ps.w.org/autoptimize/assets/icon-256X256.png?rev=2211608)
 * [Autoptimize](https://wordpress.org/plugins/autoptimize/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/autoptimize/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/autoptimize/)
 * [Active Topics](https://wordpress.org/support/plugin/autoptimize/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/autoptimize/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/autoptimize/reviews/)

 * 5 replies
 * 2 participants
 * Last reply from: [Frank Goossens](https://wordpress.org/support/users/futtta/)
 * Last activity: [9 years, 1 month ago](https://wordpress.org/support/topic/wp-localize-script/#post-9014220)
 * Status: not resolved