Register Script Generator

Home » WordPress Generators » Register Script Generator

Related WordPress generators Register style generator Add image size generator Theme.json generator Go back to all generators

The name of the function that will be created.
Child Theme Support
Allow child themes to override this function.
Where do you want this script to be used/hooked? Frontend, Login, Admin, etc.
The handle/name of the script.
The source of the script. Relative to directory or use a full URL.
Use URL
Use a URL for script source instead of the relative theme path.
Comma seperated list of dependencies of this script.
The version of the script.
Deregister First
Should the script be deregistered first?
Enqueue Script
Should the script be enqueued as well?
                    function wpturbo_register_my_custom_scripts(){
	wp_register_script( 'my-script', get_template_directory_uri() . 'my-script.js', array(), false );
	wp_enqueue_script( 'my-script' );
}
add_action( 'wp_enqueue_scripts', 'wpturbo_register_my_custom_scripts' );
                

Sign up to save your WordPress snippets on WPTurbo.