# Different Logo for Each Language

> Swaps the site logo set in the Customizer for a language-specific image, using the language from WPML, Polylang or the WordPress locale.

- Type: PHP
- Runs: Run everywhere
- Category: [Multilingual](https://wpide.com/library/category/multilingual/)
- Tags: logo, branding, language
- Author: WPIDE Team
- Installs: 0
- Updated: 2026-10-28
- Page: https://wpide.com/library/i18n-logo-per-language/

## Code

```php
$wpide_logos = array( // Language code or locale => attachment ID.
    // 'fr'    => 123,
    // 'de_DE' => 456,
);

add_filter( 'theme_mod_custom_logo', function ( $logo_id ) use ( $wpide_logos ) {
    if ( is_admin() ) {
        return $logo_id;
    }

    $locale = determine_locale();
    $code   = strtok( $locale, '_' );

    if ( defined( 'ICL_LANGUAGE_CODE' ) && ICL_LANGUAGE_CODE ) {
        $code = ICL_LANGUAGE_CODE;
    } elseif ( function_exists( 'pll_current_language' ) && pll_current_language() ) {
        $code = pll_current_language();
    }

    foreach ( array( $locale, $code ) as $key ) {
        if ( ! empty( $wpide_logos[ $key ] ) && wp_attachment_is_image( $wpide_logos[ $key ] ) ) {
            return (int) $wpide_logos[ $key ];
        }
    }

    return $logo_id;
} );
```

## Notes

Upload each logo to the Media Library and map language codes (or locales such as fr_FR) to attachment IDs in $wpide_logos.

## How to use it

Install the free WPIDE plugin (https://wordpress.org/plugins/wpide/), find "Different Logo for Each Language" 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/
