Title: wp_just_in_time_script_localization
Published: April 25, 2014
Last modified: May 20, 2026

---

# wp_just_in_time_script_localization()

## In this article

 * [Description](https://developer.wordpress.org/reference/functions/wp_just_in_time_script_localization/?output_format=md#description)
 * [Source](https://developer.wordpress.org/reference/functions/wp_just_in_time_script_localization/?output_format=md#source)
 * [Related](https://developer.wordpress.org/reference/functions/wp_just_in_time_script_localization/?output_format=md#related)
 * [Changelog](https://developer.wordpress.org/reference/functions/wp_just_in_time_script_localization/?output_format=md#changelog)

[ Back to top](https://developer.wordpress.org/reference/functions/wp_just_in_time_script_localization/?output_format=md#wp--skip-link--target)

Loads localized data on print rather than initialization.

## 󠀁[Description](https://developer.wordpress.org/reference/functions/wp_just_in_time_script_localization/?output_format=md#description)󠁿

These localizations require information that may not be loaded even by init.

## 󠀁[Source](https://developer.wordpress.org/reference/functions/wp_just_in_time_script_localization/?output_format=md#source)󠁿

    ```php
    function wp_just_in_time_script_localization() {

    	wp_localize_script(
    		'autosave',
    		'autosaveL10n',
    		array(
    			'autosaveInterval' => AUTOSAVE_INTERVAL,
    			'blog_id'          => get_current_blog_id(),
    		)
    	);

    	wp_localize_script(
    		'mce-view',
    		'mceViewL10n',
    		array(
    			'shortcodes' => ! empty( $GLOBALS['shortcode_tags'] ) ? array_keys( $GLOBALS['shortcode_tags'] ) : array(),
    		)
    	);

    	wp_localize_script(
    		'word-count',
    		'wordCountL10n',
    		array(
    			'type'       => wp_get_word_count_type(),
    			'shortcodes' => ! empty( $GLOBALS['shortcode_tags'] ) ? array_keys( $GLOBALS['shortcode_tags'] ) : array(),
    		)
    	);
    }
    ```

[View all references](https://developer.wordpress.org/reference/files/wp-includes/script-loader.php/)
[View on Trac](https://core.trac.wordpress.org/browser/tags/7.0/src/wp-includes/script-loader.php#L1942)
[View on GitHub](https://github.com/WordPress/wordpress-develop/blob/7.0/src/wp-includes/script-loader.php#L1942-L1969)

## 󠀁[Related](https://developer.wordpress.org/reference/functions/wp_just_in_time_script_localization/?output_format=md#related)󠁿

| Uses | Description | 
| [wp_get_word_count_type()](https://developer.wordpress.org/reference/functions/wp_get_word_count_type/)`wp-includes/l10n.php` |

Retrieves the word count type based on the locale.

  | 
| [wp_localize_script()](https://developer.wordpress.org/reference/functions/wp_localize_script/)`wp-includes/functions.wp-scripts.php` |

Localizes a script.

  | 
| [get_current_blog_id()](https://developer.wordpress.org/reference/functions/get_current_blog_id/)`wp-includes/load.php` |

Retrieves the current site ID.

  |

[Show 1 more](https://developer.wordpress.org/reference/functions/wp_just_in_time_script_localization/?output_format=md#)
[Show less](https://developer.wordpress.org/reference/functions/wp_just_in_time_script_localization/?output_format=md#)

## 󠀁[Changelog](https://developer.wordpress.org/reference/functions/wp_just_in_time_script_localization/?output_format=md#changelog)󠁿

| Version | Description | 
| [2.5.0](https://developer.wordpress.org/reference/since/2.5.0/) | Introduced. |

## User Contributed Notes

You must [log in](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Ffunctions%2Fwp_just_in_time_script_localization%2F)
before being able to contribute a note or feedback.