WPML
Status
Resolved
Reported for
WPML Multilingual CMS 4.6.9
Resolved in
WPML 4.6.10
Topic tags
Bug

Overview of the issue

Using version of WordPress lower than 5.9.0 with WPML 4.6.9 can result in a fatal error:

Uncaught Error: Call to undefined function WPMLBlockEditor::wp_enqueue_block_style() in /wp-content/plugins/sitepress-multilingual-cms/classes/block-editor/Loader.php:97

Workaround

You can downgrade to WPML 4.6.8, try the beta version of WPML V4.6.10, or use the directions below to patch the code until a permanent fix is issued. Please make sure you have a full backup of your site before you modify any code.

Go to: wp-content/plugins/sitepress-multilingual-cms/classes/block-editor/Loader.php and look for the method \WPML\BlockEditor\Loader::maybeEnqueueNavigationBlockStyles replace it with:

	public function maybeEnqueueNavigationBlockStyles() {
		global $wp_version;
		if ( version_compare($wp_version, '5.9.0' ) >= 0) {
			if ( ! wp_style_is( 'wp-block-navigation', 'enqueued' ) || ! wp_style_is( 'wp-block-navigation', 'queue' ) ) {
				wp_enqueue_block_style( LanguageSwitcher::BLOCK_LANGUAGE_SWITCHER, [
					'handle' => 'wp-block-navigation'
				] );
			}
		}
	}

All known issues →