wp_set_script_translations

Advertisement

Summery Summery

Sets translated strings for a script.

Syntax Syntax

wp_set_script_translations( string $handle, string $domain = 'default', string $path = null )

Description Description

Works only if the script has already been added.

Parameters Parameters

$handle

(string) (Required) Script handle the textdomain will be attached to.

$domain

(string) (Optional) Text domain.

Default value: 'default'

$path

(string) (Optional) The full file path to the directory containing translation files.

Default value: null

Return Return

(bool) True if the text domain was successfully localized, false otherwise.

Source Source

File: wp-includes/functions.wp-scripts.php

	}

	return $wp_scripts->localize( $handle, $object_name, $l10n );
}

/**
 * Sets translated strings for a script.
 *
 * Works only if the script has already been added.

Advertisement

Changelog Changelog

Changelog
Version Description
5.1.0 The $domain parameter was made optional.
5.0.0 Introduced.

See also See also

Advertisement

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.