[wp-hackers] wp_register_script() vs. wp_enqueue_script()?
if.website at gmail.com
Wed Jan 21 17:49:05 GMT 2009
On Wed, Jan 21, 2009 at 11:35 AM, Mike Schinkel
<mikeschinkel at newclarity.net> wrote:
> When, if ever, should I call wp_register_script() vs. just calling wp_enqueue_script()? The same question applies to the *_style() versions as well.
wp_register_script is particularly useful when you have several
scripts dependent on each other. So when you initialize your plugin,
you register each of the scripts with their dependencies using
wp_register_script. Then later at the point you actually need one of
the scripts to be printed, you call wp_enqueue_script using the handle
of that particular script, and WordPress handles the dependencies for
In basic situations, wp_enqueue_script is probably sufficient.
More information about the wp-hackers