WordPress filter hook · part of WordPress core

load_script_translations

A WordPress core filter that 7 plugins also fire themselves, running on 51K+ sites between them.

“This filter is documented in wp-includes/l10n.php”

How to use load_script_translations

It's a filter: your callback receives the value and 3 more arguments, and must return the (changed) value. Add this to your theme's functions.php or a small custom plugin:

functions.php
add_filter( 'load_script_translations', function( $value, $file, $handle, $domain ) {
	// Change $value here.
	return $value;
}, 10, 4 );

Argument names come from Seraphinite Accelerator's source. Other plugins may pass different values: check the call in the plugin you're targeting below.

This hook is fired by WordPress core too. Official reference on developer.wordpress.org →

7 plugins that fire load_script_translations

Sorted by active installs. Each entry shows where the plugin calls the hook and what it passes.

  1. Seraphinite Accelerator icon Seraphinite Accelerator50,000+ installs apply_filters( 'load_script_translations', @file_get_contents( $file ), $file, $handle, $domain ) Cmn/Gen.php:6826
  2. Seraphinite Post .DOCX Source icon Seraphinite Post .DOCX Source800+ installs apply_filters( 'load_script_translations', @file_get_contents( $file ), $file, $handle, $domain ) Cmn/Gen.php:6646
  3. Seraphinite Bulk Discounts for WooCommerce icon Seraphinite Bulk Discounts for WooCommerce20+ installs apply_filters( 'load_script_translations', @file_get_contents( $file ), $file, $handle, $domain ) Cmn/Gen.php:6042
  4. Seraphinite Downloads Statistics icon Seraphinite Downloads Statistics10+ installs apply_filters( 'load_script_translations', @file_get_contents( $file ), $file, $handle, $domain ) Cmn/Gen.php:6481
  5. Seraphinite Alternative Slugs Manager icon Seraphinite Alternative Slugs Manager10+ installs apply_filters( 'load_script_translations', @file_get_contents( $file ), $file, $handle, $domain ) Cmn/Gen.php:5729
  6. Crypto Coin Market Prices icon Crypto Coin Market Prices10+ installs apply_filters( 'load_script_translations', @file_get_contents( $file ), $file, $handle, $domain ) Cmn/Gen.php:2139
  7. Digispot AI icon Digispot AIFewer than 10 installs apply_filters( 'load_script_translations', (string) file_get_contents( $path ), $path, $handle, self::DOMAIN ) includes/core/class-script-translations.php:116

Need a customisation built on this hook?

Tell us what you want to change and which plugin it's for. We'll write it, test it and send it back as a small plugin.