Please make sure to update to WPML 4.3.5 and check our list of Known Issues before reporting

Hi, Amit here, I am the WPML Support Manager, our current ticket queue is high, update your WPML plugins and make sure you meet the minimal requirements for running WPML before reporting an issue please - many tickets are resolved doing that

Please look at our updated list of Known Issues and you can also use our support search to find helpful information and of course review our documentation before opening a ticket.

If you do need to open a ticket please make sure to provide us with all the needed information as described in this page

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.

This topic contains 11 replies, has 3 voices.

Last updated by Dennis 6 months, 2 weeks ago.

Assigned support staff: Dennis.

Author Posts
May 9, 2019 at 7:00 pm #3778925

Mr. Ghost

I do not want to load extra code that is not used. How do I stop WPML from executing this code: hidden link if not how can I alter the code in the core instead of overriding? Since it's loaded above the fold and is not critical css I don't want it to be treated and loaded when not used.

May 9, 2019 at 7:17 pm #3779069

Bobby
Supporter

Languages: English (English )

Timezone: America/Los_Angeles (GMT-08:00)

Hello,

please try the following and let me know your results

define('ICL_DONT_LOAD_LANGUAGE_SELECTOR_CSS', true);

May 9, 2019 at 8:03 pm #3779207

Bobby
Supporter

Languages: English (English )

Timezone: America/Los_Angeles (GMT-08:00)

you can add define('ICL_DONT_LOAD_LANGUAGE_SELECTOR_CSS', true); within your site's functions.php file

https://wpml.org/forums/topic/removing-language-selector-css/#post-92517

May 13, 2019 at 4:59 pm #3800827

Bobby
Supporter

Languages: English (English )

Timezone: America/Los_Angeles (GMT-08:00)

Hi There,

When you define the call provided above you should be able to go to WPML->Languages and get the following message on the top

ICL_DONT_LOAD_LANGUAGE_SELECTOR_CSS is defined in your theme. The language switcher can only be customized using the theme's CSS.

are you able to see it ?

This will make sure to load your custom CSS and not load WPML's CSS when custom CSS exists.

Additionally for any custom language switchers you can review the following documentation

=> https://wpml.org/documentation/getting-started-guide/language-setup/custom-language-switcher/

=> https://wpml.org/documentation/getting-started-guide/language-setup/designing-custom-language-switchers-using-template-files/

NOTE : within WPML->Languages->Menu language switcher you can edit the switcher to make it to a dropdown click and then use custom CSS to change the way the flag shows.

unfortunately we cannot provide custom work within the forum but for any custom work needed we recommend contacting our 3rd party WPML contractors
=> https://wpml.org/contractors/

please let me know if you are seeing the notice after activating define('ICL_DONT_LOAD_LANGUAGE_SELECTOR_CSS', true);

If the notice is showing are you now seeing both your custom CSS and WPML's CSS being activated in the front end ? if possible please share with me a screenshot showing both CSS being activated

at the meantime i have also contacted our developers for their feedback regarding this issue and will update you once i have news as well

May 15, 2019 at 5:56 am #3812413

Dennis

Hi,

Bobby is on vacation so I am taking care of this ticket. Hope this is okay with you.

Please take your time to follow the suggested solution.

We can't mark your threads as private since WPML support forum is a public forum. However we can delete your threads after resolving the issues and/or upon your request.

In order to help us to bring you a great service, help other users to find all the information here exposed and avoid confusion, it's better to keep only one issue on each ticket. For that reason I have to kindly ask you to open a new thread if you need further assistance with the new question(s) you have.

Thank you.

Kind regards,
Dennis

May 16, 2019 at 7:15 am #3822437

Dennis

Hi,

Thank you for your reply. I think I was able to reproduce the issue on my end. I will report this to our specialists for further investigation. I will update you here as soon as I got some feedback from them.

I will make your replies as private.

Kind regards,
Dennis

May 16, 2019 at 10:10 am #3824437

Dennis

Hi,

Thank you for waiting. Sorry, I thought I was able to reproduce the issue.

Anyway I created a test site for you to demonstrate how to disable WPML css for language switcher.

You can access it by clicking this link: hidden link

Documentation: https://wpml.org/documentation/support/wpml-coding-api/#disabling-wpmls-css-and-js-files

I have also attached images for your reference.

Kind regards,
Dennis

May 17, 2019 at 6:08 am #3831513

Mr. Ghost

I run the code as you can see but I am not able to see your notification: hidden link

I do not see the wpml notification which you do. I do not use functions.php since we don't use child theme since it's redundant 2019 when I can run everything more dynamic with code snippet php plugin. Which saves and is easily controllable no matter theme and easy enable/disable. Never an issue. But might be for wpml for some reason.

It still not works for me, sandbox does not help since it's not my platform I'm telling you guys I do not work you can try to replicate it and run code snippet on a proper environment.

but I added the code for you and work but does not work for me and do not see the notification in WPML dashboard that it's disabled. Even tried to run the snippet everywhere and not only frontend without success.

Can you tell me what all those files is for. Seems like I can disable all of them (if it ever works) since we have no use of them. But please clearify what you add css and js for here. Becomes very much redundant in most sites especially us. So prefer to not load code that does not need to load.

ICL_DONT_LOAD_NAVIGATION_CSS
ICL_DONT_LOAD_LANGUAGE_SELECTOR_CSS
ICL_DONT_LOAD_LANGUAGES_JS

Please make all my threads private.

May 17, 2019 at 6:47 am #3831657

Mr. Ghost

Update seems to be that I could not only run the code on the frontend? It's only loaded in the frontend but your filter do not support that?

Now I can see "ICL_DONT_LOAD_LANGUAGE_SELECTOR_CSS is defined in your theme. The language switcher can only be customized using the theme's CSS."

Can you refine and make me better understand the other CSS and JS so that I can disable them as well. Can not really see what they are used for. But looks like I can and should disable them since we do not use your navigation code and style. And it might solve other issues as well.

But when adding all of them it does not show in the wpml dashboard that they are disabled:

define('ICL_DONT_LOAD_LANGUAGE_SELECTOR_CSS', true);
define('ICL_DONT_LOAD_NAVIGATION_CSS', true);
define('ICL_DONT_LOAD_LANGUAGES_JS', true);
May 17, 2019 at 9:13 am #3832631

Dennis

Hi,

The file path are described below:

ICL_DONT_LOAD_LANGUAGES_JS ->

wp-content/plugins/sitepress-multilingual-cms/templates/language-switchers/legacy-dropdown/script.js

ICL_DONT_LOAD_NAVIGATION_CSS ->

wp-content/plugins/wpml-cms-nav/res/css/cms-navigation.css?ver=1.5.1

This is only if you have WPML CMS Navigation plugin installed.

Kind regards,
Dennis

May 20, 2019 at 4:28 pm #3848929

Mr. Ghost

Does not explain where they are sued for more than templates and cms navigation. Are all executing any code frontend? Can I stop wpml from executing any css and js frontend please.

May 21, 2019 at 5:49 am #3852017

Dennis

Hi,

These constant definitions will disable WPML css/js codes in the frontend.

Are you still seeing any WPML css/js files being executed in the frontend? If so, could you please specify which code is it? It would be great if you can provide some screenshots for us to better understand the issue.

Kind regards,
Dennis

The topic ‘[Closed] Remove default wpml-flag code’ is closed to new replies.