LLMS_Assets::register_script( string $handle )

Registers a defined script with WordPress


Description Description

The script must be defined in one of the following places:

  • The script definition list found at includes/assets/llms-assets-scripts.php
  • Added to the definition list via the llms_get_script_asset_definitions filter
  • Added "just in time" via the llms_get_script_asset filter.

If the script is not defined this function will return false.


Top ↑

Parameters Parameters

$handle

(string) (Required) The script's handle.


Top ↑

Return Return

(boolean)


Top ↑

Source Source

File: includes/class-llms-assets.php

	 * @return boolean
	 */
	public function register_script( $handle ) {

		$script = $this->get( 'script', $handle );
		if ( $script ) {

			array_map( array( $this, 'register_script' ), $script['dependencies'] );

			$reg = wp_register_script( $handle, $script['src'], $script['dependencies'], $script['version'], $script['in_footer'] );
			if ( $reg && $script['translate'] ) {
				$this->set_script_translations( $script );
			}

			return $reg;

		}

		return false;


Top ↑

Changelog Changelog

Changelog
Version Description
5.5.0 Automatically register all of the asset's dependencies.
4.9.0 Automatically set script translations when translate=true.
4.4.0 Introduced.

Top ↑

User Contributed Notes User Contributed Notes

You must log in before being able to contribute a note or feedback.