WordPress Enqueuing scripts

Help us to keep this website almost Ad Free! It takes only 10 seconds of your time:
> Step 1: Go view our video on YouTube: EF Core Bulk Extensions
> Step 2: And Like the video. BONUS: You can also share it!

Syntax

  • wp_enqueue_script( $handle, $src, $deps, $ver, $in_footer)

Parameters

ParameterDetails
$handle(string) (Required) Name of the script. Should be unique.
$src(string) (Optional) Full URL of the script, or path of the script relative to the WordPress root directory. Default value: false
$deps(array) (Optional) An array of registered script handles this script depends on. Default value: array()
$ver(string | bool | null) (Optional) String specifying script version number, if it has one, which is added to the URL as a query string for cache busting purposes. If version is set to false, a version number is automatically added equal to current installed WordPress version. If set to null, no version is added. Default value: false
$in_footer(bool) (Optional) Whether to enqueue the script before </body> instead of in the <head>. Default value: false


Got any WordPress Question?