Skip Navigation

Resolved

Reported for: WPML Multilingual CMS 4.5.10

Resolved in: 4.5.11

Topic Tags: Bug, Compatibility

Overview of the issue

If you are translating a website created with Divi theme but you are using a WPML Multilingual Blog license, you will find the following error when you try to create a new page:

PHP Fatal error: Uncaught Error: Undefined constant “WPML_TM_FOLDER” in …\wp-content\plugins\sitepress-multilingual-cms\addons\wpml-page-builders\classes\Integrations\Divi\TinyMCE.php:21
Stack trace:
#0 …\wp-content\plugins\sitepress-multilingual-cms\addons\wpml-page-builders\classes\Integrations\Divi\TinyMCE.php(21): constant(‘WPML_TM_FOLDER’)
#1 …\wp-includes\class-wp-hook.php(309): WPML\Compatibility\Divi\TinyMCE->filterEditorAutoTags(Array)
#2 …\wp-includes\plugin.php(191): WP_Hook->apply_filters(Array, Array)
#3 …\wp-includes\script-loader.php(560): apply_filters(‘tiny_mce_before…’, Array, ‘classic-block’)
#4 ….\wp-admin\edit-form-blocks.php(252): wp_tinymce_inline_scripts()
#5 …\wp-admin\post-new.php(72): require(‘C:\\xampp8\\htdoc…’)
#6 {main}
thrown in …\wp-content\plugins\sitepress-multilingual-cms\addons\wpml-page-builders\classes\Integrations\Divi\TinyMCE.php on line 21

Workaround

Please make sure of having a full backup of your website:

  1. Open /wp-content/plugins/sitepress-multilingual-cms/addons/wpml-page-builders/classes/Integrations/Divi/TinyMCE.php file.
  2. Look for line 9.
  3. Replace:
    public function add_hooks() {
        add_filter( 'tiny_mce_before_init', [ $this, 'filterEditorAutoTags' ] );
    }
    

    With:

    public function add_hooks() {
        if ( defined( 'WPML_TM_FOLDER' ) ) {
            add_filter( 'tiny_mce_before_init', [ $this, 'filterEditorAutoTags' ] );
        }
    }