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.

This topic contains 6 replies, has 0 voices.

Last updated by Otto 4 days, 10 hours ago.

Assisted by: Otto.

Author Posts
May 6, 2025 at 2:10 pm #17002024

justinT-3

Background of the issue:
I am trying to set up the language toggle option in WPML on my site using the Rosa LT (Pixelgrade) theme (Anima). I encountered a critical error that causes the site to crash. The theme developer suggested modifying the method output_badge_menu_item() in /wp-content/themes/anima/inc/admin/class-admin-nav-menus.php by changing WP_Post to $item without a type hint. I made this change, but it hasn't fixed the issue. I need help to get this site live ASAP. Link to a page where the issue can be seen: hidden link

Symptoms:
I am getting a critical error when trying to set up the language toggle option in WPML, causing the site to crash. The error is related to the method output_badge_menu_item() expecting a WP_Post, while WPML’s language-switcher sends a WPML_LS_Menu_Item object.

Questions:
How can I resolve the critical error when setting up the language toggle option in WPML?
Why didn't the suggested code change fix the issue?

May 7, 2025 at 12:51 pm #17006652

Otto
WPML Supporter since 09/2015

Languages: English (English ) Spanish (Español )

Timezone: America/Argentina/Buenos_Aires (GMT-03:00)

Hello,

This theme is not in our compatibility list, however, it doesn't necessarily imply that it is not compatible, just that our team has not tested it yet.

You may try this workaround:
<b>Switch to WPML’s shortcode‑based language switcher</b>
– Go to <b>WPML → Languages → Custom language switchers</b>
– Enable and configure.
– In your primary menu, add a

[wpml_disabled_switcher]

custom link (empty URL)
– Theme receives plain HTML; no object casting occurs.
– Optionally style via CSS per the docs.

https://wpml.org/errata/not-possible-to-add-a-language-switcher-to-the-navigation-block/

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

Is this a suitable alternative for you?

Best Regards,
Otto

May 10, 2025 at 11:02 am #17018727

justinT-3

Hi Otto,

Thank you so much for getting back to me. unfortunately, I can't follow your suggested instructions because I can¡t access the custom language switchers (see screenshot) because of the site critical error. It seems to have completely blocked this part of the plugin. Can you suggest any other workaround.

I'm really desperate for a solution. The Theme developer told me (before I purchased the theme) that it was compatible with WPML and although he has suggested a few workarounds, none seem to do the trick. I've invested many hours into preparing this site and I need WPML to work with the theme.

I am not technically savvy and would appreciate any help you could give me to get this sorted out.

Kind regards,

Justin

Languages-‹-new-enriquesrestaurantepizzeria-com-—-WordPress-05-07-2025_06_37_PM.png
May 10, 2025 at 11:27 am #17018753

justinT-3

Hi again Otto,

Not sure if its of any help but this is the error log on the site:

[06-May-2025 12:12:59 UTC] PHP Fatal error: Uncaught TypeError: anima_add_primary_menu_item_description(): Argument #2 ($item) must be of type WP_Post, WPML_LS_Menu_Item given, called in /var/www/b402329f-63a6-43f5-a56f-34f87d96639b/new.enriquesrestaurantepizzeria.com/wp-includes/class-wp-hook.php on line 324 and defined in /var/www/b402329f-63a6-43f5-a56f-34f87d96639b/new.enriquesrestaurantepizzeria.com/wp-content/themes/anima/inc/extras.php:377 Stack trace: #0 /var/www/b402329f-63a6-43f5-a56f-34f87d96639b/new.enriquesrestaurantepizzeria.com/wp-includes/class-wp-hook.php(324): anima_add_primary_menu_item_description('

May 12, 2025 at 1:58 pm #17023325

Otto
WPML Supporter since 09/2015

Languages: English (English ) Spanish (Español )

Timezone: America/Argentina/Buenos_Aires (GMT-03:00)

Hello,

WPML cannot guarantee compatibility with every WordPress product. Unfortunately, this theme is not supported.

IMHO, the best option is to switch to a supported theme:
https://wpml.org/theme/

I can take a look at the problem, but we can't debug and fix the theme's code.

I would like to request temporary access (wp-admin and FTP) to your site to take a better look at the issue.
It would be better to a testing site where the issue is replicated.

The information you will enter is private which means only you and I can see and have access to it.
Maybe I'll need to replicate your site locally. For this, I'll need to temporarily install a plugin called “Duplicator” or "All in One WP Migration" on your site.
This will allow me to create a copy of your site and your content.
Once the problem is resolved I will delete the local site.

**IMPORTANT**
- Please make a backup of site files and database before providing us access.
- If you do not see the wp-admin/FTP fields this means your post & website login details will be made PUBLIC. DO NOT post your website details unless you see the required wp-admin/FTP fields.

Best Regards,
Otto

May 15, 2025 at 8:50 pm #17038779

justinT-3

Hi Otto,

Thank you for offering to help with this. I have just heard back from the Theme Developer and he has made some changes to the Theme code which has fixed the issue for the time being. I understand what you say about using a theme that is fully compatible with WPML, but the guys at Pixelgrade actually told be that it was compatible before I bought the theme. I'm a little annoyed as I have spent a lot of time on the site and changing to another theme isn't an option at the moment. I'll just see if it works for the time being and perhaps look at changing further down the line.
I know you used to be compatible with the older Rosa Theme (because I had it on my site and it worked fine with WPML). It's a shame that this is no longer the case and would be nice to see you guys work with Pixelgrade to get WPML working with their Rosa LT Theme.
Thank you again for offering to help.

Best regards,

Justin

May 16, 2025 at 11:41 am #17041355

Otto
WPML Supporter since 09/2015

Languages: English (English ) Spanish (Español )

Timezone: America/Argentina/Buenos_Aires (GMT-03:00)

Hi Justin,

Thanks.

For sure, we are certainly open to cooperating with the author to make it work.

As it's on the author's end now, I am closing here. If you have any other issues, don't hesitate to open a new ticket.

Best Regards,
Otto