Skip Navigation

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.

Tagged: 

This topic contains 10 replies, has 2 voices.

Last updated by Andrey 3 months, 1 week ago.

Assisted by: Andrey.

Author Posts
July 30, 2024 at 6:10 pm #16021810

technicalS-2

<b>Background of the issue: </b>
I am trying to add some custom CSS to my website. I navigated to Appearance > Customize > Additional CSS. The issue can be seen on this page: hidden link.

<b>Symptoms: </b>
I expected the right side of the screen to be blank, indicating no errors. Instead, I got a fatal error: Fatal error: Uncaught TypeError: array_intersect_key(): Argument #1 ($array) must be of type array, bool given in /var/www/html/wp-content/plugins/sitepress-multilingual-cms/classes/language-switcher/class-wpml-ls-templates.php:73 Stack trace: #0 /var/www/html/wp-content/plugins/sitepress-multilingual-cms/classes/language-switcher/class-wpml-ls-templates.php(73): array_intersect_key() #1 /var/www/html/wp-content/plugins/sitepress-multilingual-cms/classes/language-switcher/class-wpml-ls-assets.php(41): WPML_LS_Templates->get_templates() #2 /var/www/html/wp-includes/class-wp-hook.php(324): WPML_LS_Assets->wp_enqueue_scripts_action() #3 /var/www/html/wp-includes/class-wp-hook.php(348): WP_Hook->apply_filters() #4 /var/www/html/wp-includes/plugin.php(517): WP_Hook->do_action() #5 /var/www/html/wp-includes/script-loader.php(2263): do_action() #6 /var/www/html/wp-includes/class-wp-customize-manager.php(462): wp_enqueue_scripts() #7 /var/www/html/wp-includes/class-wp-customize-manager.php(561): WP_Customize_Manager->wp_die() #8 /var/www/html/wp-includes/class-wp-hook.php(324): WP_Customize_Manager->setup_theme() #9 /var/www/html/wp-includes/class-wp-hook.php(348): WP_Hook->apply_filters() #10 /var/www/html/wp-includes/plugin.php(517): WP_Hook->do_action() #11 /var/www/html/wp-settings.php(630): do_action() #12 /var/www/html/wp-config.php(122): require_once('...') #13 /var/www/html/wp-load.php(50): require_once('...') #14 /var/www/html/wp-blog-header.php(13): require_once('...') #15 /var/www/html/index.php(20): require('...') #16 {main} thrown in /var/www/html/wp-content/plugins/sitepress-multilingual-cms/classes/language-switcher/class-wpml-ls-templates.php on line 73.

<b>Questions: </b>
How can I resolve the fatal error caused by WPML when adding custom CSS?
Is there a workaround to prevent WPML from interfering with my website's CSS rendering?

t1.jpg
July 30, 2024 at 6:47 pm #16022002

Andrey
Supporter

Languages: English (English ) Russian (Русский )

Timezone: Europe/Kyiv (GMT+02:00)

I apologize for the issue you encountered with this.

Are you having the issue if you remove your custom CSS?

Also, please try deactivating the "Disable cache for language switcher templates" option in the WPML → Support → Troubleshooting link and check if the issue persists.

Remember to back up your database before making any changes.

July 30, 2024 at 8:22 pm #16022250

technicalS-2

I have not changed my custom CSS (yet), and this used to work fine. Something has changed outside of CSS.

I disabled the cache and problem remains.

July 31, 2024 at 9:14 pm #16026961

Andrey
Supporter

Languages: English (English ) Russian (Русский )

Timezone: Europe/Kyiv (GMT+02:00)

I need to request temporary access (wp-admin and FTP) to your site – preferably to a test site where the problem has been replicated if possible – in order to be of better help. You will find the needed fields for this below the comment area when you log in to leave your next reply. The information you will enter is private which means only you and I can see and have access to it.

August 1, 2024 at 9:28 pm #16031399

Andrey
Supporter

Languages: English (English ) Russian (Русский )

Timezone: Europe/Kyiv (GMT+02:00)

Thank you for providing the information. Can you please direct me to the specific site I should check? I've noticed that it's a multisite and the site I logged into WPML is not configured.

August 1, 2024 at 11:40 pm #16031547

technicalS-2

The error reported above is for the telium site: hidden link.

August 5, 2024 at 1:06 pm #16040165

Andrey
Supporter

Languages: English (English ) Russian (Русский )

Timezone: Europe/Kyiv (GMT+02:00)

I've done some tests, and I was able to save the custom CSS in your theme options. Did I miss something?

I attached the screenshot.

Global-Options-‹-Telium-—-WordPress.png
August 6, 2024 at 1:30 am #16042313

technicalS-2

There is still a WPML error. Though what did you change to make the failure message go away.

To reproduce the error, open an icognito browser and browse to hidden link and the home page renders fine. Then browse elsewhere (eg :cnn.com) and then browse back to hidden link

Now the layout boxes stack vertically instead of horizontally, box borders are missing, icons on the scroller down below are stacking overlapping, scroller no longer works, etc. If you browse to hidden link vs hidden link you get different results. My CSS no longer loads properly, javascript seems to have problems.

All of this stems from the WPML plugin. Something is still very wrong. Very briefly when the home page first loads, there is a PHP error, something about string to array. But it dissappears in under a second. I don't see this with WPML off....I think this is a clue.

August 6, 2024 at 11:31 am #16043642

Andrey
Supporter

Languages: English (English ) Russian (Русский )

Timezone: Europe/Kyiv (GMT+02:00)

Thank you for your feedback.

It seems that the error is not in the admin but elsewhere. Could you please provide screenshots? Does the issue occur when you add custom CSS? Have you also added custom CSS to other languages by switching the language in the dashboard (on the theme options page)?

August 6, 2024 at 12:17 pm #16043781
technicalS-2

If you browse directly to the website with the language suffix (hidden link ) then the site renders correctly as shows in attached images good1 and good2.

If you browse to the website without language suffix (hidden link ) then the site renders incorrectly as shown in images bad1 and bad2.

Somehow the WPML plugin/redirection/code is causing the site to malfunction. I don't think its CSS related, since I moved the entire site to a new host (running more recent wordpress + php), and then the problem appeared. All worked fine on the old host. And since the buy occurs only with WPML redirection/language suffix on the URL all signs point to WPML.

good2.jpg
good1.jpg
bad2.jpg
bad1.jpg
August 6, 2024 at 12:26 pm #16043937

Andrey
Supporter

Languages: English (English ) Russian (Русский )

Timezone: Europe/Kyiv (GMT+02:00)

Thank you for clarifying the issue.

Since the issue differs from what you originally reported, I have created a new ticket for your new question. By doing so, other users who have similar questions can easily find the solution on the forum. I will reply here: https://wpml.org/forums/topic/split-somehow-the-wpml-plugin-redirection-code-is-causing-the-site-to-malfunction/