SOLUTION: Uncaught Error: Call to undefined method WP_Textdomain_Registry::reset() 

This is written in English, due to the urgency of the issue and changes WPML dev made.

If you are using WPML and this error: Uncaught Error: Call to undefined method WP_Textdomain_Registry::reset() 

The solution is the following:

You can either update WPML (you might not be able to see the updates, i have a fix). OR you will have to downgrade to WordPress 6.0

Update WPML

To update WPML to the newest version you possibly cannot see, you will need their “OTGS Installer”.

You can download it from the site.

  • Delete all WPML plugins from your site,
  • Install the OTGS Installer and activate it.
  • If you see the button “Check for updates” click it. If you do not, check if the latest version of WPML is Version 4.5.12 and released on the 31st of October.
  • If you do not see it, then switch to the BETA channel, there is a small dropdown for this at the top of the installer.

The WPML dev team has fixed the issue, but there is no release to the WP plugin, as shown in my image here:

They have had the updates since the 31st and we still cannot see them. Causing an update to WP 6.1 to crash the site.

How i found it and more details on the fix

How I found out it was a Wp 6.1 issue because I tried to debug the issue for several hours (since there were no updates) and found that the class WP_Textdomain_Registry was added in 6.1, and there is no function called reset. The code WPML used in the file: /wp-content/plugins/wpml-string-translation/classes/MO/Hooks/LanguageSwitch.php was the following:

	private function resetTranslationAvailabilityInformation() {
		global $wp_textdomain_registry;

		if ( $wp_textdomain_registry ) {
			$wp_textdomain_registry->reset();
		} elseif ( function_exists( '_get_path_to_translation' ) ) {
			_get_path_to_translation( null, true );
		}
	}

Where it should be similar to my solution here (and it’s a similar solution WPML devs did):

	private function resetTranslationAvailabilityInformation() {
          
                if( function_exists( '_get_path_to_translation' ) ) {

                        _get_path_to_translation( null, true );

                }

	}


After my own fix, I tried to original code and did a downgrade and the site worked again. Upgraded again and used my code, then the site worked again.

After that, I tried to contact WPML about their plugin not working with 6.1 and they already knew about the issue and released a real fix, instead of my quick code or downgrade.

close

Få mine tips direkte i din indbakke

Tilmeld dig for at modtage mit nyhedsbrev og hold dig opdateret med det nyeste herfra.

Vi spammer ikke! Læs vores privatlivspolitik hvis du vil vide mere.

Skriv en kommentar