WPML

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

This issue is fixed. Updating to the latest version solves it on your site, so you only need this workaround if you can’t update yet.

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:
    PHP
    public function add_hooks() {
        add_filter( 'tiny_mce_before_init', [ $this, 'filterEditorAutoTags' ] );
    }
    With:
    PHP
    public function add_hooks() {
        if ( defined( 'WPML_TM_FOLDER' ) ) {
            add_filter( 'tiny_mce_before_init', [ $this, 'filterEditorAutoTags' ] );
        }
    }

All known issues

Still Seeing This Issue?

If updating doesn’t fix it, ask a support question and we’ll look into it with you.