# Translate Customizer Text Settings With WPML

> Registers chosen Customizer (theme_mod) text settings, such as a footer copyright or header phone number, in WPML String Translation and shows the translated value in each language.

- Type: PHP
- Runs: Run everywhere
- Category: [Multilingual](https://wpide.com/library/category/multilingual/)
- Tags: wpml, customizer, string-translation
- Author: WPIDE Team
- Installs: 0
- Updated: 2026-10-28
- Page: https://wpide.com/library/wpml-translate-theme-mods/

## Code

```php
$wpide_mods = array( 'footer_text', 'header_phone' ); // theme_mod names to translate.

add_action( 'customize_save_after', function () use ( $wpide_mods ) {
    foreach ( $wpide_mods as $mod ) {
        $value = get_theme_mod( $mod );
        if ( is_string( $value ) && '' !== $value ) {
            do_action( 'wpml_register_single_string', 'Theme mods', $mod, $value );
        }
    }
} );

add_action( 'admin_init', function () use ( $wpide_mods ) {
    if ( ! defined( 'ICL_SITEPRESS_VERSION' ) || get_transient( 'wpide_wpml_mods_registered' ) ) {
        return;
    }
    foreach ( $wpide_mods as $mod ) {
        $value = get_theme_mod( $mod );
        if ( is_string( $value ) && '' !== $value ) {
            do_action( 'wpml_register_single_string', 'Theme mods', $mod, $value );
        }
    }
    set_transient( 'wpide_wpml_mods_registered', 1, DAY_IN_SECONDS );
} );

if ( ! is_admin() ) {
    foreach ( $wpide_mods as $wpide_mod ) {
        add_filter( 'theme_mod_' . $wpide_mod, function ( $value ) use ( $wpide_mod ) {
            return is_string( $value ) && '' !== $value
                ? apply_filters( 'wpml_translate_single_string', $value, 'Theme mods', $wpide_mod )
                : $value;
        } );
    }
}
```

## Notes

List the theme_mod names in $wpide_mods (find them in your theme's customizer code). Strings refresh in String Translation whenever the Customizer is saved.

## How to use it

Install the free WPIDE plugin (https://wordpress.org/plugins/wpide/), find "Translate Customizer Text Settings With WPML" in its snippet library and add it in one click; or create a new PHP snippet in WPIDE (or any code snippets plugin) and paste the code above. More snippets: https://wpide.com/library/
