Open
Overview of the issue
WPML allows you to display WordPress widgets in all your site’s languages or only on specific languages using the Display on language dropdown menu.
However since WordPress 5.8, if you add a Custom HTML widget, it will be display on all languages regardless of your settings.
Workaround
As a workaround, click on the Widget’s menu and transform it to a Group block. Then you can select the language from the Display on language dropdown.
I’ve noticed this issue and wanted to add that there is a JS Console error, which may be related to the issue.
/wp-content/plugins/sitepress-multilingual-cms/vendor/wpml/tm/dist/js/ate-jobs-sync/app.js?ver=2.11.0
Uncaught (in promise) ReferenceError: ajaxurl is not defined
at app.js?ver=2.11.0:6
at app.js?ver=2.11.0:6
at app.js?ver=2.11.0:6
at app.js?ver=2.11.0:6
at app.js?ver=2.11.0:83
at c (app.js?ver=2.11.0:35)
at Generator._invoke (app.js?ver=2.11.0:35)
at Generator.next (app.js?ver=2.11.0:35)
at n (app.js?ver=2.11.0:6)
at s (app.js?ver=2.11.0:6)
I’m guessing someone just assumed the ajaxurl was going to be defined by a plugin in php, but it wasn’t and now it’s failing to make it’s own ajax calls and thus the language selector is having issue. I could be 100% wrong, and this could be unrelated but I feel it’s a good place to start debugging.
Hello!
As far as I know, this variable is defined in wp-content/plugins/sitepress-multilingual-cms/vendor/wpml/tm/classes/ATE/Review/ReviewTranslation.php
Now, if you have some unexpected issues with this, may I suggest that you open a ticket in our support forum, so that we can try to debug this further and possibly find a fix or at least a workaround for your case?
I have the same problem. Even though at the top of the page I have
var ajaxurl = '/wp-admin/admin-ajax.php',
, I get an error sayingUncaught (in promise) ReferenceError: ajaxurl is not defined
, and widget language settings are not saved.I have the same issue. Even though I have
var ajaxurl = '/wp-admin/admin-ajax.php',
on the top of the page (widget admin), I get the errorUncaught (in promise) ReferenceError: ajaxurl is not defined
when I try to save changes. Language settings of widgets are not saved.Hello Alexander,
According to your description it sounds like a different issue from the one reported here. Could you please open a ticket in our support forum where one of our supporters will be able to investigate it?
Regards
Hi there, is there any update on this error? Unfortunatly the workaround which is described here by transforming it to a Group block (https://wpml.org/errata/wordpressp-5-8-custom-html-widgets-are-displayed-in-all-languages/) does not work. We are using WordPress 5.8.2 and Theme Brigsby Premium Child. Thank you for an answer. Paul
Hello Paul,
By the moment we don’t have any major updates here. If the workaround here provided does not work, could you please open a ticket in our support forum so we can investigate your case?
Regards
Hi,
Is there any workaround for this issue before a final fix is completed. Thanks !!
Hello there,
Have you tried the workaround here provided? If this does not help, please open a ticket in our support forum as it may be a different issue and we need to investigate it.
This CSS will hide the empty blocks created by the Group workaround.
.widget:empty{
display:none; /* Hide empty blocks – hack for https://wpml.org/errata/wordpressp-5-8-custom-html-widgets-are-displayed-in-all-languages/ */
}
Thank you for sharing this approach, Pablo,