Skip to content Skip to sidebar

This is the technical support forum for WPML - the multilingual WordPress plugin.

Everyone can read, but only WPML clients can post here. WPML team is replying on the forum 6 days per week, 22 hours per day.

Sun Mon Tue Wed Thu Fri Sat
9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 - -
14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 - -

Supporter timezone: Asia/Yerevan (GMT+04:00)

Tagged: 

This topic contains 11 replies, has 0 voices.

Last updated by Christopher Amirian 2 weeks, 5 days ago.

Assisted by: Christopher Amirian.

Author Posts
May 6, 2026 at 6:29 pm #18018589

alstonC

I have a widget section in the header that contains the language switcher widget. Most of the pages on the site do not have translations and are only in the main site language of English. Can you point me towards how to have the widget not appear at all on the page if that page only exists in the main site language, but if additional translations for that page are available to then show the widget?

May 7, 2026 at 12:04 pm #18020231

Shekhar Bhandari
WPML Supporter since 03/2015

Languages: English (English )

Timezone: Asia/Kathmandu (GMT+05:45)

Hello there,

Thank you for contacting WPML support. I'd be happy to assist you on this issue.

To debug this issue further, I would need to check your site settings once, for this I would need temporary access (wp-admin and ftp) to your site.

So could you please provide me with those details, you will find the needed fields for this below the comment area when you log in to leave your next reply.
hidden link

This info is private and available to you and WPML supporters only.
Read more about this: https://wpml.org/purchase/support-policy/privacy-and-security-when-providing-debug-information-for-support/

Note:
Backup your sites before providing the credentials or if possible provide credentials for the test site

Look forward to your reply.

Thanks

May 11, 2026 at 9:17 am #18026580

Shekhar Bhandari
WPML Supporter since 03/2015

Languages: English (English )

Timezone: Asia/Kathmandu (GMT+05:45)

Hello there,

The login details provided do not seem to be working on my end. Could you please check and update them if needed?

Also, please share the exact URLs where the issue can be seen so I can investigate it further.

Looking forward to your reply.

Thanks

May 14, 2026 at 12:04 am #18034475

alstonC

Hello Shekhar, sorry for that inconvenience, the password was off. I've updated it and all of the previous private information I shared works for both admin access and sftp.

Thanks.

May 15, 2026 at 6:20 am #18037433

Shekhar Bhandari
WPML Supporter since 03/2015

Languages: English (English )

Timezone: Asia/Kathmandu (GMT+05:45)

Hello there,

Just to let you know, I am currently discussing this issue with our 2nd tier supporters. I will update you as soon as I have more feedback to share.

Thanks

May 15, 2026 at 10:21 am #18038418

Shekhar Bhandari
WPML Supporter since 03/2015

Languages: English (English )

Timezone: Asia/Kathmandu (GMT+05:45)

Hello there,

Our 2nd tier checked the issue and suggested the following code to fix the issue.

You can add this in theme functions.php file

add_filter( 'widget_display_callback', function( $instance ){

    if ( isset($instance['content']) && str_contains( $instance['content'], 'language-switcher' ) && is_singular() ){

        global $post;
        $element_type = 'post_' . $post->post_type;
        $trid = apply_filters( 'wpml_element_trid', NULL, $post->ID, $element_type );
        $translations = apply_filters( 'wpml_get_element_translations', NULL, $trid, $element_type );

        if ( count($translations) === 1 ){
            return false;
        }
    }

    return $instance;
});

Let me know if this helps.

Thanks

May 15, 2026 at 11:59 pm #18039927

alstonC

Hello Shakhar, that did not fix it. I use this plugin on multiple sites and I'm fairly certain in all of those cases there was a setting in the vast library of settings for this plugin that solved this issue rather than having to add custom code to functions.php.

For this site in question on this ticket, the switcher is added to a custom widget area. In my other sites it's coded into the header without using a widget location. Would this have anything to do with why this is happening?

Thanks.

May 18, 2026 at 7:20 am #18041696

Shekhar Bhandari
WPML Supporter since 03/2015

Languages: English (English )

Timezone: Asia/Kathmandu (GMT+05:45)

Hello there,

When the switcher is used as a dropdown, it is currently not possible to disable the current language option. I believe you are referring to the similar setting available for horizontal switchers, where disabling the current language is supported.

I have forwarded your feedback to our 2nd tier supporters for further review.

Thanks

May 18, 2026 at 8:54 pm #18044253

alstonC

Thanks Shekhar, I am interested to hear what what they say.

May 19, 2026 at 9:44 am #18045167

Christopher Amirian
WPML Supporter since 07/2020

Languages: English (English )

Timezone: Asia/Yerevan (GMT+04:00)

Hi,

This is Christopher taking over this ticket as Shekhar is on vacation.

The second-tier support mentioned that you used the legacy WPML language switcher. Please use the block language switcher as this page:

hidden link

The second tier add the new block language switcher and you can compare.

Thanks.

May 19, 2026 at 8:28 pm #18046955

alstonC

Hello Christopher, looks like the block switcher is working perfectly. Thank you! Quick question, the code block that Shakhar pasted above, is that only to work with the block switcher (referred to as 'language-switcher' in the function?)

Thanks.

May 20, 2026 at 11:55 am #18048565

Christopher Amirian
WPML Supporter since 07/2020

Languages: English (English )

Timezone: Asia/Yerevan (GMT+04:00)

Hi,

No need for the code anymore as you use the new langauge switcher.

Thanks.

The topic ‘[Closed] Only show switcher widget if translations exist, otherwise to not render on page’ is closed to new replies.