# Notice When WPML Shows Content in Another Language

> Adds a short notice above posts that WPML displays in the default language because no translation exists yet ("display as translated" mode), so visitors know why the text is not in their language.

- Type: PHP
- Runs: Run everywhere
- Category: [Multilingual](https://wpide.com/library/category/multilingual/)
- Tags: wpml, notices, translations
- Author: WPIDE Team
- Installs: 0
- Updated: 2026-10-28
- Page: https://wpide.com/library/wpml-fallback-language-notice/

## Code

```php
$wpide_notice = 'This content is not available in your language yet, so we are showing the original version.';

add_action( 'admin_init', function () use ( $wpide_notice ) {
    do_action( 'wpml_register_single_string', 'WPIDE Snippets', 'Fallback language notice', $wpide_notice );
} );

add_filter( 'the_content', function ( $content ) use ( $wpide_notice ) {
    if ( ! defined( 'ICL_SITEPRESS_VERSION' ) || is_admin() || ! is_singular() || ! in_the_loop() || ! is_main_query() ) {
        return $content;
    }

    $details = apply_filters( 'wpml_post_language_details', null, get_the_ID() );
    $current = apply_filters( 'wpml_current_language', null );

    if ( ! is_array( $details ) || empty( $details['language_code'] ) || $details['language_code'] === $current ) {
        return $content;
    }

    $text = apply_filters( 'wpml_translate_single_string', $wpide_notice, 'WPIDE Snippets', 'Fallback language notice' );

    return '<p class="wpide-fallback-notice" role="note" style="padding:.75em 1em;border-inline-start:4px solid #dba617;background:rgba(219,166,23,.1)">' . esc_html( $text ) . '</p>'
        . '<div lang="' . esc_attr( $details['language_code'] ) . '">' . $content . '</div>';
} );
```

## Notes

Translate the notice text through String Translation under the "WPIDE Snippets" domain after visiting the dashboard once.

## How to use it

Install the free WPIDE plugin (https://wordpress.org/plugins/wpide/), find "Notice When WPML Shows Content in Another 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/
