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 4 replies, has 2 voices.

Last updated by mariaA-45 1 year, 11 months ago.

Assisted by: Christopher Amirian.

Author Posts
July 7, 2023 at 8:44 pm #13970177

mariaA-45

Tell us what you are trying to do?
On my backend, the admin language switcher is broken. I cannot access any of my content anymore - pages/products. The front-end seems to be fine, just the backend is affected.

What is the link to your site?
develobaby.com

What did you do?
I have Danish as main language. English iand German were configured as translations, German was hidden, English was active. I deleted German from the WPML=>Languages settings and when asked, I deleted all German translations from the database. When I reloaded the Dashboard, the Language Switcher was broken and error messages started to come in...

Which error messages do you see:
At the top of the admin-backend, I see these error messages:
Warning: Trying to access array offset on value of type null in /var/www/develobaby.com/public_html/wp-content/plugins/sitepress-multilingual-cms/menu/wpml-admin-lang-switcher.class.php on line 179

Warning: Trying to access array offset on value of type null in /var/www/develobaby.com/public_html/wp-content/plugins/sitepress-multilingual-cms/menu/wpml-admin-lang-switcher.class.php on line 252

In the WooCommerce Logs, I can see hundreds of these "FATAL" stack traces:

2023-07-07T20:39:03+00:00 CRITICAL Uncaught Error: Call to a member function get_cart_contents_count() on null in /var/www/develobaby.com/public_html/wp-content/themes/kadence/inc/template-functions/header-functions.php:743
Stack trace:
#0 /var/www/develobaby.com/public_html/wp-includes/class-wp-hook.php(308): Kadence\header_cart('')
#1 /var/www/develobaby.com/public_html/wp-includes/class-wp-hook.php(332): WP_Hook->apply_filters('', Array)
#2 /var/www/develobaby.com/public_html/wp-includes/plugin.php(517): WP_Hook->do_action(Array)
#3 /var/www/develobaby.com/public_html/wp-content/themes/kadence/template-parts/header/cart.php(18): do_action('kadence_header_...')
#4 /var/www/develobaby.com/public_html/wp-includes/template.php(785): require('/var/www/develo...')
#5 /var/www/develobaby.com/public_html/wp-includes/template.php(718): load_template('/var/www/develo...', false, Array)
#6 /var/www/develobaby.com/public_html/wp-includes/general-template.php(204): locate_template(Array, true, false, Array)
#7 /var/www/develobaby.com/public_html/wp-content/themes/kadence/inc/components/custom_header/component.php(212): get_template_part('template-parts/...')
#8 [internal function]: Kadence\Custom_Header\Component->render_header('main', 'right')
#9 /var/www/develobaby.com/public_html/wp-content/themes/kadence/inc/components/template_tags.php(87): call_user_func_array(Array, Array)
#10 /var/www/develobaby.com/public_html/wp-content/themes/kadence/inc/template-functions/header-functions.php(59): Kadence\Template_Tags->__call('render_header', Array)
#11 /var/www/develobaby.com/public_html/wp-includes/class-wp-hook.php(308): Kadence\header_column('main', 'right')
#12 /var/www/develobaby.com/public_html/wp-includes/class-wp-hook.php(332): WP_Hook->apply_filters('', Array)
#13 /var/www/develobaby.com/public_html/wp-includes/plugin.php(517): WP_Hook->do_action(Array)
#14 /var/www/develobaby.com/public_html/wp-content/themes/kadence/template-parts/header/header-row.php(86): do_action('kadence_render_...', 'main', 'right')
#15 /var/www/develobaby.com/public_html/wp-includes/template.php(785): require('/var/www/develo...')
#16 /var/www/develobaby.com/public_html/wp-includes/template.php(718): load_template('/var/www/develo...', false, Array)
#17 /var/www/develobaby.com/public_html/wp-includes/general-template.php(204): locate_template(Array, true, false, Array)
#18 /var/www/develobaby.com/public_html/wp-content/themes/kadence/inc/components/template_parts/component.php(71): get_template_part('template-parts/...', 'row')
#19 [internal function]: Kadence\Template_Parts\Component::get_template('template-parts/...', 'row', Array)
#20 /var/www/develobaby.com/public_html/wp-content/themes/kadence/inc/components/template_tags.php(87): call_user_func_array(Array, Array)
#21 /var/www/develobaby.com/public_html/wp-content/themes/kadence/inc/template-functions/header-functions.php(39): Kadence\Template_Tags->__call('get_template', Array)
#22 /var/www/develobaby.com/public_html/wp-includes/class-wp-hook.php(308): Kadence\main_header('')
#23 /var/www/develobaby.com/public_html/wp-includes/class-wp-hook.php(332): WP_Hook->apply_filters('', Array)
#24 /var/www/develobaby.com/public_html/wp-includes/plugin.php(517): WP_Hook->do_action(Array)
#25 /var/www/develobaby.com/public_html/wp-content/themes/kadence/template-parts/header/base.php(45): do_action('kadence_main_he...')
#26 /var/www/develobaby.com/public_html/wp-includes/template.php(785): require('/var/www/develo...')
#27 /var/www/develobaby.com/public_html/wp-includes/template.php(718): load_template('/var/www/develo...', false, Array)
#28 /var/www/develobaby.com/public_html/wp-includes/general-template.php(204): locate_template(Array, true, false, Array)
#29 /var/www/develobaby.com/public_html/wp-content/themes/kadence/inc/template-functions/header-functions.php(21): get_template_part('template-parts/...')
#30 /var/www/develobaby.com/public_html/wp-includes/class-wp-hook.php(308): Kadence\header_markup('')
#31 /var/www/develobaby.com/public_html/wp-includes/class-wp-hook.php(332): WP_Hook->apply_filters('', Array)
#32 /var/www/develobaby.com/public_html/wp-includes/plugin.php(517): WP_Hook->do_action(Array)
#33 /var/www/develobaby.com/public_html/wp-content/themes/kadence/header.php(49): do_action('kadence_header')
#34 /var/www/develobaby.com/public_html/wp-includes/template.php(783): require_once('/var/www/develo...')
#35 /var/www/develobaby.com/public_html/wp-includes/template.php(718): load_template('/var/www/develo...', true, Array)
#36 /var/www/develobaby.com/public_html/wp-includes/general-template.php(48): locate_template(Array, true, true, Array)
#37 /var/www/develobaby.com/public_html/wp-content/themes/kadence/404.php(12): get_header()
#38 /var/www/develobaby.com/public_html/wp-includes/template-loader.php(106): include('/var/www/develo...')
#39 /var/www/develobaby.com/public_html/wp-blog-header.php(19): require_once('/var/www/develo...')
#40 /var/www/develobaby.com/public_html/index.php(17): require('/var/www/develo...')
#41 {main}
  thrown i /var/www/develobaby.com/public_html/wp-content/themes/kadence/inc/template-functions/header-functions.php på linje 743
2023-07-07 22_31_20-Sider ‹ DeveloBaby — WordPress.png
July 7, 2023 at 9:00 pm #13970203

mariaA-45

Okay, okay, everybody relax! This was apparently just a mild glitch. The problem was apparently that the Admin Language Switcher was set to German, which I had just deleted. Visiting a back-end URL with an existing language solved the whole issue, as the Language Switcher was able to recover when pointed at an existing language. *phew*

I added this to my back end URL, because I knew that Danish 'da' exists:
?post_type=page&lang=da&admin_bar=1

Good weekend!
Maria

July 9, 2023 at 1:40 am #13972235

Christopher Amirian
WPML Supporter since 07/2020

Languages: English (English )

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

Hi Maria,

I am glad that you have managed to fix the issue.

You also can change the language of the admin for each user by going to Users > Profile and change the language there.

Thanks.

July 9, 2023 at 5:46 am #13972277

mariaA-45

Just for the record: I didn't think the back-end language switcher located in the top bar on every back-end was about switching the back-end interface language, but about showing contents (page, posts, products, etc) that the back-end shows for the chosen language.
If that is correct, then I don't understand, what changing the user language in the user profile has to do with this ticket as this would affect, which language the whole back-end is presented in, but not *which content* to show.

Best,
Maria