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 was wondering is there any convention or what is the right way for naming handles in wp_register_script() and wp_register_style() functions?

For example if I am developing a plugin that uses modernizer, is it better simply naming it 'modernizer' or something unique like 'my-script-modernizer'?

If it is better to have unique handles and I am developing multiple plugins and I'm sure all uses same script. Should I use same handle in all plugins?

share|improve this question
up vote 0 down vote accepted

This question does to a degree solicit opinionated answers, but I feel it's a good one nonetheless.
As far as my opinion goes and the way I handle things is this:

Definitely use the same handle for the same script in all your plugins and/or themes. You don't want to load exact duplicates, if two of your plugins are used in the same WP install.

I give a generic handle to widely used and renowned scripts such as modernizr. Why should such a script be loaded more than once, under different handles?
I prefix handles of my own scripts, for reasons of namespacing.

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.