[wp-hackers] wp_register_script() vs. wp_enqueue_script()?
mikeschinkel at newclarity.net
Thu Jan 22 06:15:04 GMT 2009
"Austin Matzko" <if.website at gmail.com> wrote:
> You need the name (or the "handle") because WP_Dependencies,
> the class behind all of this, makes sure that it doesn't
> enqueue the same handle more than once at any given time.
Thanks for the reply.
So using enqueue *can* achieve the same register with the addition of also emitting the link into the header. If I misunderstand please let me know otherwise it's what I assumed would make sense.
> That also answers your other question about duplicate
> scripts: duplicates are avoided so long as the handles
> are the same.
But that would only help *if* different plugins used the same name, right? So three different plugins could register "Nifty Corners" respectively each as the following and they would all three get included, right?
1.) wp_register_script('niftycorners', ...);
2.) wp_register_script('nifty-corners', ...);
3.) wp_register_script('nifty_corners', ...);
Hence my suggestion to have a single place to list how they are used...?
More information about the wp-hackers