Register WordPress Scripts

Overview

Use this tool to create custom code for Script Registration with wp_register_script() function.

Usage

  • Fill in the user-friendly form.
  • Click the “Update Code” button.
  • Copy the code to your project.
  • Or save it as a snippet and share with the community.

Examples

If you are still learning how to use this tool, check out the following examples:

The function used in the code.
Where to enqueue? Front end, login, admin or embed.
Name used in the code as a script handle.
URL to the script.
Comma separated list of scripts to load before this script.
Script version number.
Load the script in the header or the footer.
Deregister the script first.
Enqueue the script.
Name used in the code as a script handle.
URL to the script.
Comma separated list of scripts to load before this script.
Script version number.
Load the script in the header or the footer.
Deregister the script first.
Enqueue the script.
Name used in the code as a script handle.
URL to the script.
Comma separated list of scripts to load before this script.
Script version number.
Load the script in the header or the footer.
Deregister the script first.
Enqueue the script.
Name used in the code as a script handle.
URL to the script.
Comma separated list of scripts to load before this script.
Script version number.
Load the script in the header or the footer.
Deregister the script first.
Enqueue the script.
Name used in the code as a script handle.
URL to the script.
Comma separated list of scripts to load before this script.
Script version number.
Load the script in the header or the footer.
Deregister the script first.
Enqueue the script.
  Save Snippet
// Register Script
function custom_scripts() {

	wp_deregister_script( 'jquery' );
	wp_register_script( 'jquery', '//code.jquery.com/jquery-2.1.1.min.js', false, '2.1.1', false );
	wp_enqueue_script( 'jquery' );

	wp_deregister_script( 'bootstrap' );
	wp_register_script( 'bootstrap', '//maxcdn.bootstrapcdn.com/bootstrap/3.2.0/js/bootstrap.min.js', array( 'jquery' ), '3.2.0', false );
	wp_enqueue_script( 'bootstrap' );

}
add_action( 'wp_enqueue_scripts', 'custom_scripts' );