Title: Avoiding load javascript where map is not present
Last modified: August 21, 2016

---

# Avoiding load javascript where map is not present

 *  [mandave](https://wordpress.org/support/users/mandave/)
 * (@mandave)
 * [12 years, 6 months ago](https://wordpress.org/support/topic/avoiding-load-javascript-where-map-is-not-present/)
 * Hello everyone,
 * I have a “problem/question” on the following web site:
 * [http://www.finswimmer.com/](http://www.finswimmer.com/)
 * as you can easily see in the source code of the home page, there is a javascript
   relative to Store Locato, which I use in another page (just one in the entire
   site)
 * Is it possible to avoid the loading of that js code in the home page?
 * Thanks in advance.
 * Dave.
 * [http://wordpress.org/plugins/store-locator/](http://wordpress.org/plugins/store-locator/)

Viewing 1 replies (of 1 total)

 *  [Justin Givens](https://wordpress.org/support/users/justindgivens/)
 * (@justindgivens)
 * [12 years, 3 months ago](https://wordpress.org/support/topic/avoiding-load-javascript-where-map-is-not-present/#post-4295657)
 * I’m with Dave on this. No need to load it on all pages. One reason for me is 
   because you are querying the database each time looking for the shortcode.
 * Dave, I did this:
 *     ```
       //In my theme function file
       ///Removing store locater from the head.
       remove_action('wp_head', 'sl_head_scripts');
       if( is_page() ) {
       	add_action( 'wp_head' , 'sl_head_scripts' );
       }
       ```
   
 * It now only loads on that specific page. I would not recommend anyone editing
   the plugin because when updates come out you will lose those.
 * Thanks,
    Justin

Viewing 1 replies (of 1 total)

The topic ‘Avoiding load javascript where map is not present’ is closed to new replies.

 * ![](https://s.w.org/plugins/geopattern-icon/store-locator_343c21.svg)
 * [Store Locator for WordPress with Google Maps – LotsOfLocales](https://wordpress.org/plugins/store-locator/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/store-locator/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/store-locator/)
 * [Active Topics](https://wordpress.org/support/plugin/store-locator/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/store-locator/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/store-locator/reviews/)

## Tags

 * [javascript](https://wordpress.org/support/topic-tag/javascript/)

 * 1 reply
 * 2 participants
 * Last reply from: [Justin Givens](https://wordpress.org/support/users/justindgivens/)
 * Last activity: [12 years, 3 months ago](https://wordpress.org/support/topic/avoiding-load-javascript-where-map-is-not-present/#post-4295657)
 * Status: not resolved