Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

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
    
Related: wordpress.stackexchange.com/questions/58226/… –  toscho Sep 27 '13 at 11:27

1 Answer 1

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

 
discard

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.