wp_enqueue_script


wp_enqueue_script ( $handle, $src = '', $deps = array(), $ver = false, $in_footer = false )

Parameters:
  • (string) $handle Name of the script. Should be unique.
  • (string) $src Full URL of the script, or path of the script relative to the WordPress root directory. Default empty.
  • (array) $deps Optional. An array of registered script handles this script depends on. Default empty array.
  • (string|bool|null) $ver 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.
  • (bool) $in_footer Optional. Whether to enqueue the script before </body> instead of in the <head>. Default 'false'.
See:
  • WP_Dependencies::add()
  • WP_Dependencies::add_data()
  • WP_Dependencies::enqueue()
Defined at:

Description

Enqueue a script.

Registers the script if $src provided (does NOT overwrite), and enqueues it.

Related Functions

wp_enqueue_scripts, wp_dequeue_script, wp_enqueue_style, wp_enqueue_editor, enqueue_embed_scripts

Top Google Results

User discussions

wpseek mobile