[wp-hackers] wp_enqueue_script interCapping gotcha

Art Delano ajd at cloudiness.com
Wed Oct 7 15:17:56 UTC 2009


wp_enqueue_script got me again this morning. I couldn't figure out why  
the following didn't work:

function jquerykicker() {
    $asdf = WP_CONTENT_URL.'/themes/mytheme/scripts/display.js';
    wp_enqueue_script('launchAll',$asdf,array('jquery'),'',TRUE);
}
add_action('template_redirect','jquerykicker');

The problem was "launchAll" - wp_enqueue_script will only accept  
lowercase strings for the handle. Changing it to "launchall" (without  
editing the display.js file) fixed everything.

Is there a reason for this constraint? There's no harm to my scripts  
to keep the string lowercased, but I feel like it wastes a lot of time  
to repeatedly debug sites that aren't working because I forgot to  
lowercase a string.

Art


More information about the wp-hackers mailing list