wp_enqueue_script() WordPress注册js函数

介绍

wp_enqueue_script( string $handle, string $src = '', array $deps = array(), string|bool|null $ver = false, bool $in_footer = false )

wp_enqueue_script() 是WordPress注册和引用一个js的函数。

参数

$handle

(string) (必填) js名称,必填,并且不能重复。
$src

(string) (选填) 完整的js链接地址。

Default value: ”
$deps

(array) (选填) 数组,此脚本依赖的注册脚本。

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