Skip to content Skip to sidebar

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.

Sun Mon Tue Wed Thu Fri Sat
- 8:00 – 13:00 9:00 – 13:00 9:00 – 13:00 8:00 – 12:00 8:00 – 12:00 -
- 14:00 – 17:00 14:00 – 18:00 14:00 – 18:00 13:00 – 17:00 13:00 – 17:00 -

Supporter timezone: Europe/Zagreb (GMT+02:00)

This topic contains 6 replies, has 2 voices.

Last updated by Bruno Kos 1 year, 5 months ago.

Assisted by: Bruno Kos.

Author Posts
September 28, 2024 at 10:23 pm #16232368

majaN-3

Background of the issue:
I am trying to resolve an error that appeared in wp-cli: Fatal error: Uncaught Error: Call to a member function get_language_codes() on bool in /home/xxxxxx/public_html/wp-content/plugins/wpml-string-translation/classes/slug-translation/class-wpml-slug-translation-records.php:233. I found this topic with your suggestion that resolved that error so I followed the steps: https://wpml.org/forums/topic/call-to-a-member-function-get_language_codes-on-bool-2/. I got stuck on the last step: "Fix post type assignment for translations" - it is loading forever.

Symptoms:
Usually when each step was completed a popup window with "Done" appeared, but now nothing. It has been working for over 1 hour. At some point I will have to close the browser and will I break something?

Questions:
Will closing the browser break something?
Why is the 'Fix post type assignment for translations' step loading forever?

September 30, 2024 at 6:26 am #16234464

Bruno Kos
WPML Supporter since 12/2018

Languages: English (English ) German (Deutsch ) French (Français )

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

Hi,

Can you try this:

1. Open your **wp-config.php** file and insert the following lines just before the comment that says `/* That's all, stop editing! Happy publishing. */`:

define( 'WP_DEBUG', true );
define( 'WP_DEBUG_LOG', true );
define( 'WP_DEBUG_DISPLAY', false );

2. After saving the changes, try reproducing the issue by attempting to **Fix post type assignment for translations** again.

3. Once the issue occurs, locate the **debug log** file at this path: `/wp-content/debug.log`.

4. Please share the **latest 20 lines** from the log file here. No need to paste the entire log file—just the most recent lines. Make sure to censor any sensitive information.

Regards,
Bruno Kos

October 13, 2024 at 8:43 am #16282789

majaN-3

I have followed your steps and after running "Fix post type assignment" it was completed very fast and got message "No errors were found in the assignment of post types."

October 13, 2024 at 8:46 am #16282791

majaN-3

However when running wp-cli I am still getting an error and here is entire error:

Fatal error: Uncaught Error: Call to a member function get_language_codes() on bool in /home/xxxuserxxx/public_html/wp-content/plugins/wpml-string-translation/classes/slug-translation/class-wpml-slug-translation-records.php:233
Stack trace:
#0 /home/xxxuserxxx/public_html/wp-content/plugins/wpml-string-translation/classes/slug-translation/class-wpml-slug-translation.php(226): WPML_Slug_Translation_Records->get_all_slug_translations(Array)
#1 /home/xxxuserxxx/public_html/wp-content/plugins/wpml-string-translation/classes/slug-translation/class-wpml-slug-translation.php(269): WPML_Slug_Translation->get_all_post_slug_translations()
#2 /home/xxxuserxxx/public_html/wp-includes/class-wp-hook.php(324): WPML_Slug_Translation->filter_pre_get_posts(Object(WP_Query))
#3 /home/xxxuserxxx/public_html/wp-includes/class-wp-hook.php(348): WP_Hook->apply_filters('', Array)
#4 /home/xxxuserxxx/public_html/wp-includes/plugin.php(565): WP_Hook->do_action(Array)
#5 /home/xxxuserxxx/public_html/wp-includes/class-wp-query.php(1881): do_action_ref_array('pre_get_posts', Array)
#6 /home/xxxuserxxx/public_html/wp-includes/class-wp-query.php(3852): WP_Query->get_posts()
#7 /home/xxxuserxxx/public_html/wp-includes/post.php(6249): WP_Query->query(Array)
#8 /home/xxxuserxxx/public_html/wp-content/plugins/redux-framework/redux-core/inc/classes/class-redux-wordpress-data.php(272): get_pages(Array)
#9 /home/xxxuserxxx/public_html/wp-content/plugins/redux-framework/redux-core/inc/classes/class-redux-wordpress-data.php(119): Redux_WordPress_Data->get_data('pages', Array, NULL)
#10 /home/xxxuserxxx/public_html/wp-content/plugins/redux-framework/redux-core/inc/classes/class-redux-options-defaults.php(177): Redux_WordPress_Data->get('pages', Array, 'houzez_options')
#11 /home/xxxuserxxx/public_html/wp-content/plugins/redux-framework/redux-core/inc/classes/class-redux-options-defaults.php(88): Redux_Options_Defaults->field_default_values('houzez_options', Array, Object(Redux_WordPress_Data), false)
#12 /home/xxxuserxxx/public_html/wp-content/plugins/redux-framework/redux-core/inc/classes/class-redux-api.php(343): Redux_Options_Defaults->default_values('houzez_options', Array, Object(Redux_WordPress_Data))
#13 /home/xxxuserxxx/public_html/wp-content/plugins/redux-framework/redux-core/inc/classes/class-redux-api.php(393): Redux::set_defaults('houzez_options')
#14 /home/xxxuserxxx/public_html/wp-content/plugins/redux-framework/redux-core/inc/classes/class-redux-api.php(432): Redux::load_redux('houzez_options')
#15 /home/xxxuserxxx/public_html/wp-includes/class-wp-hook.php(324): Redux::create_redux('')
#16 /home/xxxuserxxx/public_html/wp-includes/class-wp-hook.php(348): WP_Hook->apply_filters(NULL, Array)
#17 /home/xxxuserxxx/public_html/wp-includes/plugin.php(517): WP_Hook->do_action(Array)
#18 /home/xxxuserxxx/public_html/wp-settings.php(700): do_action('init')
#19 hidden link): require('/home/xxxuserxxx/...')
#20 hidden link): WP_CLI\Runner->load_wordpress()
#21 hidden link): WP_CLI\Runner->start()
#22 hidden link): WP_CLI\Bootstrap\LaunchRunner->process(Object(WP_CLI\Bootstrap\BootstrapState))
#23 hidden link): WP_CLI\bootstrap()
#24 hidden link): include('hidden link...')
#25 /usr/local/bin/wp(4): include('hidden link...')
#26 {main}
thrown in /home/xxxuserxxx/public_html/wp-content/plugins/wpml-string-translation/classes/slug-translation/class-wpml-slug-translation-records.php on line 233

October 14, 2024 at 6:08 am #16284034

Bruno Kos
WPML Supporter since 12/2018

Languages: English (English ) German (Deutsch ) French (Français )

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

Can you tell me which WP-CLI command are you running which triggers the error?

October 14, 2024 at 4:12 pm #16287147

majaN-3

wp media regenerate --only-missing

However I did try another WP cli command a week ago, I forgot which one and got the same error.

October 15, 2024 at 6:59 am #16288778

Bruno Kos
WPML Supporter since 12/2018

Languages: English (English ) German (Deutsch ) French (Français )

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

I see, this will require debugging then.

To troubleshoot this problem, I'll install the Duplicator plugin and generate packages for further debugging purposes. I'll ensure to exclude all media files to maintain a minimal package size. You can find more information about the process here: [link](https://wpml.org/faq/provide-supporters-copy-site/). Please confirm if this approach is acceptable to you.

https://wpml.org/purchase/support-policy/privacy-and-security-when-providing-debug-information-for-support/

I marked your next reply as private so that you can safely add credentials.

The topic ‘[Closed] Resolving wp-cli error Call to a member function get_language_codes()’ is closed to new replies.