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

Last updated by Alejandro 11 months, 2 weeks ago.

Assisted by: Alejandro.

Author Posts
June 30, 2024 at 2:31 pm #15862579

nicoM-5

Background of the issue:
I am trying to activate the 'password-protected' plugin using WP CLI commands. The following error is thrown when running WP CLI commands, e.g. wp plugin activate password-protected. This has already been reported at https://wpml.org/forums/topic/call-to-a-member-function-get_language_codes-on-bool/ where Andrey offered to set up an identical clone installation for us. Please go ahead and do so. The error has occurred hundreds of times over the past three months on at least two installations.

Symptoms:
Fatal error: Uncaught Error: Call to a member function get_language_codes() on bool in /home/cosmos/public_html/steuerportal.ch/wp-content/plugins/wpml-string-translation/classes/slug-translation/class-wpml-slug-translation-records.php:233

Questions:
Why is the error 'Call to a member function get_language_codes() on bool' occurring when running WP CLI commands?
Can you set up an identical clone installation as mentioned in the forum post?

June 30, 2024 at 2:31 pm #15862587

nicoM-5

Additional: your support system says that the REST API isn't available. That is incorrect: it can be publicly accessed.

July 1, 2024 at 9:02 am #15866987

Alejandro
WPML Supporter since 02/2018

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

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

Hello!

In the past ticket you had 2 issues: a performance one and the issue mentioned in this ticket.

We can handle only one issue per ticket. I'd suggest we continue with this WP-CLI issue.

I read the ticket from before and back then Andrey had asked you to make sure you were installing WPML 4.6.10.

At this point I'd like to ask:

- The steps you're taking (or even a quick video if it's faster for you. you can use a tool like hidden link to do that fast and easy).

- The issue is happening when you want to activate a plugin via WP-CLI, but not WPML or a related plugin, correct? in this case it's "password-protected"?

---------------

About the REST issue, that's very likely a false positive. it's highly probable that your server is blocking the call we use to understand if REST is disabled or not. it won't affect anything on your site more than the notice.

July 1, 2024 at 11:37 am #15868178

nicoM-5

Thanks for your feedback. The performance issues remain, but this issue with the fatal error is more important right now.

WPML and associated plugins are installed in their latest versions.

There is only one step: I'm executing the command 'wp plugin install password-protected' on the command line.

Which endpoint is WPML attempting to reach? I can happily verify what response this endpoint is returning.

July 1, 2024 at 3:41 pm #15869697

Alejandro
WPML Supporter since 02/2018

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

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

I tried to recreate the problem on my end and couldn't. everything worked correctly which tells me the problem is an isolated case of your site.

From the error i suspect the problem is that you have content in the database that might be missing the language information.

can you tell me if you tried these steps:

1) Go to WPML -> Support -> Troubleshooting and press the following buttons:

• "Clear the cache in WPML"
• "Remove ghost entries from the translation tables"
• "Fix element_type collation"
• "Set language information"
• "Fix post type assignment for translations"

You can click everything inside the "Clean Up" section so you can have an even better chance at solving the problem. just do not click "set language information" before every other step has been completed and only press "Fix post type assignment for translations" after you have clicked "Set Language Information".

Also, avoid clicking "Reset Languages" if you have modified any of the languages (you can go ahead if you haven't and are just using the pre-defined languages without any modification to it).

Here's the video showing you that it works for me and also showing you the procedure mentioned above, in case it comes handy to you: hidden link

------------------
If that doesn't work, then we can try getting a dump of your site so i can try to figure out what's going on without any risk on your end (you can provide one for me using a plugin like duplicator or WP All In One Migration, where you EXCLUDE images and possible backups, to make the file lighter).

By the way, the error here is not because of an endpoint (or well, it's unlikely) but because of a fatal error caused because wp-CLI is trying to update or touch something that involves WPML in any way.

July 4, 2024 at 11:08 am #15891420

nicoM-5

Thank you for your suggestions, Alejandro. I have tested the workflow on three installations now, all of which suffered from the problems, and the five steps you suggested appear to have resolved the issue.