WPDev.one
Core Function
View Source on Trac ↗

wp_add_inline_script()

wp_add_inline_script( mixed $handle, mixed $data, mixed $position = 'after' )

Adds extra code to a registered script.

Parameters 3 required

Name / Type Description
$handle
string

Name of the script to add the inline script to.

Required
$data
string

String containing the JavaScript to be added.

Required
string

$position Optional. Whether to add the inline script before the handle or after. Default 'after'.

Required

Return Value

(bool)
True on success, false on failure.

Function Information

Since Version
4.5.0
Source File
wp-includes/functions.wp-scripts.php
Advertisement