Thinking about this further, it seems that WPML works without blocks but is looking for blocks with CP v2. So there must be something in CP v2 that makes WPML think it uses blocks.
If you can ask WPML what this âtriggerâ is, we should be able to fix the issue. Unfortunately, since thatâs a paid plugin that I donât personally use, I canât just go through the code myself and take a look
I admit I didnât test this plugin in CP RC 2, because it is working in 1.7.2, so I assumed it shouldnât cause any issues in the final release :). Will try to enquiry support team about this.
Iâve been discussing the issue with WPML support for a last few days, and while not fully resolved, the following piece of code prevents from throwing the fatal error and allows using WPML in CP ver. 2.0.0.:
Go to wp-content/plugins/sitepress-multilingual-cms/classes/block-editor/class-wpml-block-editor-helper.php
However, in my local website, the above fix caused subsequent fatal error:
PHP Fatal error: Uncaught Error: Call to undefined function WPML\BlockEditor\wp_enqueue_block_style() in /wp-content/plugins/sitepress-multilingual-cms/classes/block-editor/Loader.php:97
which I fixed by commenting a few lines in Loader.php:
public function maybeEnqueueNavigationBlockStyles() {
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'
//] );
}
}
This was not necessary in the live website, so apparently this might be server configuration-related.
And one more thing: When translating content, I had to enable use of âWordPress Editorâ for the entire content, because âWPML Translation Editorâ was throwing other fatal errors, apparently related to blocks.
I was told the issues might be resolved in the future WPML releases, but maybe this will help to apply a fix on the CP side anyway. And obviously before applying the above fix it is advised to back up the website.
Just a side note: register_block_type can be checked to see if the site is on WP 4.9.
And was also valid to determine that the site is on ClassicPress v1.
But now that v2 has polyfilled version of some block function, the best way is to check for is classicpress_version function.