Title: wp_enqueue_script won&#039;t load remote scripts
Last modified: August 21, 2016

---

# wp_enqueue_script won't load remote scripts

 *  Resolved [pixeldreamer](https://wordpress.org/support/users/pixeldreamer/)
 * (@pixeldreamer)
 * [13 years ago](https://wordpress.org/support/topic/wp_enqueue_script-wont-load-remote-scripts/)
 * I’ve been trying to troubleshoot an issue I’ve been having with wp_enqueue_script
   for over a week now. I’ve read everything I can find on wp_enqueue_script and
   nothing addresses the problem I’m experiencing.
 * Here’s the code in my functions.php:
 *     ```
       function my_scripts() {
           wp_enqueue_script( 'jquery' );
           wp_enqueue_script( 'modernizr', 'http://cdnjs.cloudflare.com/ajax/libs/modernizr/2.0.6/modernizr.min.js', 'jquery', false );
       }
       add_action( 'wp_enqueue_scripts', 'my_scripts' );
       ```
   
 * The issue I’m having is that modernizr isn’t getting loaded. If I view the source
   that’s being generated I see this:
 * `<script type='text/javascript' src='/ajax/libs/modernizr/2.0.6/modernizr.min.
   js?ver=3.5.1'></script>`
 * Somehow the remote url is being removed. My question is why? And how do I get
   it to load from the remote source I’ve specified?
 * Thanks in advance for any help you’re able to provide.
 * Best,
    Mac

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

 *  Thread Starter [pixeldreamer](https://wordpress.org/support/users/pixeldreamer/)
 * (@pixeldreamer)
 * [12 years, 12 months ago](https://wordpress.org/support/topic/wp_enqueue_script-wont-load-remote-scripts/#post-3697341)
 * Still haven’t solved this… still really need a solution. Anyone?
 *  [Pioneer Web Design](https://wordpress.org/support/users/swansonphotos/)
 * (@swansonphotos)
 * [12 years, 12 months ago](https://wordpress.org/support/topic/wp_enqueue_script-wont-load-remote-scripts/#post-3697342)
 * Try:
 *     ```
       function my_scripts() {
           wp_enqueue_script( 'jquery' );
           wp_enqueue_script( 'modernizr', '//cdnjs.cloudflare.com/ajax/libs/modernizr/2.0.6/modernizr.min.js', 'jquery', false );
       }
       add_action( 'wp_enqueue_scripts', 'my_scripts' );
       ```
   
 * Below was replied to by [Otto](http://profiles.wordpress.org/otto42).
 * [http://wordpress.stackexchange.com/questions/82940/how-can-i-enqueue-protocol-relative-external-ajax-googleapis-com-scripts](http://wordpress.stackexchange.com/questions/82940/how-can-i-enqueue-protocol-relative-external-ajax-googleapis-com-scripts)
   `
 *  Thread Starter [pixeldreamer](https://wordpress.org/support/users/pixeldreamer/)
 * (@pixeldreamer)
 * [12 years, 12 months ago](https://wordpress.org/support/topic/wp_enqueue_script-wont-load-remote-scripts/#post-3697343)
 * I solved this issue this morning—there was nothing wrong with my code, the actual
   problem was being caused the the Root Relative URLs plugin that Rackspace installs
   by default when you setup a WordPress site on their Cloud Sites platform. I disabled
   that plugin and the issue disappeared. I appreciate the reply nonetheless—it 
   was a good thought. Thank you!

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

The topic ‘wp_enqueue_script won't load remote scripts’ is closed to new replies.

## Tags

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

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 3 replies
 * 2 participants
 * Last reply from: [pixeldreamer](https://wordpress.org/support/users/pixeldreamer/)
 * Last activity: [12 years, 12 months ago](https://wordpress.org/support/topic/wp_enqueue_script-wont-load-remote-scripts/#post-3697343)
 * Status: resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
