I am not sure what to do here. The codex doesn’t have a bunch of information. When loading scripts into your WordPress theme, do you have to register the script first or can you just enqueue it? Both seem to do the same thing.
- Sold between 250 000 and 1 000 000 dollars
- Community Moderator
- Author was Featured
- Item was Featured
- Bought between 50 and 99 items
- Referred between 1000 and 1999 users
- Has been a member for 3-4 years
- Repeatedly Helped protect Envato Marketplaces against copyright violations
Registering it just registers the map of $handle to $src. Registering a script will not automatically load it on your site.
Enqueue actually queues the script to be loaded into the markup.
Enqueue will automatically do the registering, so generally you don’t need to use wp_register_script at all.
For registered scripts, you can enqueue them simply by calling wp_enqueue_script on the $handle, without passing the other arguments.
Hope that clears it up 
EDIT
In other words,
//register and enqueue myscript in one step wp_enqueue_script( 'myscript', 'path/to/myscript.js', array( 'jquery' ), '1.2', true );
is equivalent to
//register myscript (tell WordPress it exists and where to find it) wp_register_script( 'myscript', 'path/to/myscript.js', array( 'jquery' ), '1.2', true ); //enqueue myscript (actually add it to the page) wp_enqueue_script( 'myscript' );
it does, although still a little confusing. I just don’t see any reason to have wp_register_script if enqueue does the same thing.
There are some situations where this could come in handy – for example if your theme or plugin has used a script for quite a while and other plugins depends on this script > Compatibility.
But in most cases wp_enqueue_script() is enough
Here’s an article about it: http://wpcandy.com/teaches/how-to-load-scripts-in-wordpress-themes
Using wp_register_script() and wp_enqueue_script() together also makes things more organized and easier to keep track of. I personally, just use wp_enqueue_script()
some good information. Thanks guys
- Sold between 250 000 and 1 000 000 dollars
- Community Moderator
- Author was Featured
- Item was Featured
- Bought between 50 and 99 items
- Referred between 1000 and 1999 users
- Has been a member for 3-4 years
- Repeatedly Helped protect Envato Marketplaces against copyright violations
One other reason register_script exists is so that WordPress can register all of the scripts that it packages in the core product and allow the developer to simply call wp_enqueue_script( ‘jquery’ ) for instance, without worrying about src paths, etc.
Now that is the reason that prompted the “aha” moment in my head.
