WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have seen script and style handles written in two different ways in wp_register_script and wp_enqueue_script (the same applies to wp_register_style and wp_enqueue_style):

  1. wp_register_script( 'jquery-someplugin', $location );
  2. wp_register_script( 'jquery.someplugin', $location );

#1 uses a hyphen, #2 uses a period. What is the best practice here?

Which should I be using?

share|improve this question
up vote 5 down vote accepted

Use hyphens only.

Take a look at wp-includes/script-loader.php:

$scripts->add( 'scriptaculous-sound', '/wp-in
$scripts->add( 'scriptaculous-controls', '/wp
$scripts->add( 'scriptaculous', '', array('sc

// not used in core, replaced by Jcrop.js
$scripts->add( 'cropper', '/wp-includes/js/cr

$scripts->add( 'jquery', '/wp-includes/js/jqu

// full jQuery UI
$scripts->add( 'jquery-ui-core', '/wp-include
$scripts->add( 'jquery-effects-core', '/wp-in

$scripts->add( 'jquery-effects-blind', '/wp-i
$scripts->add( 'jquery-effects-bounce', '/wp-
$scripts->add( 'jquery-effects-clip', '/wp-in
$scripts->add( 'jquery-effects-drop', '/wp-in
$scripts->add( 'jquery-effects-explode', '/wp
$scripts->add( 'jquery-effects-fade', '/wp-in
$scripts->add( 'jquery-effects-fold', '/wp-in
$scripts->add( 'jquery-effects-highlight', '/
$scripts->add( 'jquery-effects-pulsate', '/wp
$scripts->add( 'jquery-effects-scale', '/wp-i
$scripts->add( 'jquery-effects-shake', '/wp-i
$scripts->add( 'jquery-effects-slide', '/wp-i
$scripts->add( 'jquery-effects-transfer', '/w

$scripts->add( 'jquery-ui-accordion', '/wp-in
$scripts->add( 'jquery-ui-autocomplete', '/wp

Yes, I copied a rectangle. :)

The unofficial naming scheme is: main library first, then package, then sub-package, all separated by hyphens.

If you follow this scheme – and other developers too! – you lower the risk to enqueue the same library as another plugin just with another name.

Unfortunately, even in core you can find exceptions: 'suggest' and 'schedule' are using jQuery …

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.