Viewing 1 replies (of 1 total)
  • Plugin Support Vishali Tayal

    (@vishali009)

    Hi @eijsbroek,

    Thank you for sharing the detailed error log — that really helped 👍

    The issue occurred because you are using a Divi child theme where the theme version is shown as:

    Version: Updated for Divi 3+

    While the actual Divi parent theme version installed is 4.27.3.

    In our plugin, we were previously checking the Divi version like this:

    if (wp_get_theme()->get('Version') >= 5)
    

    Since your child theme does not return a numeric version (it returns a text string), the condition failed and incorrectly attempted to load the Divi 5 module files. That’s why this error occurred:

    Class “ET\Builder\Framework\Route\RESTRoute” not found
    

    That class exists only in Divi 5, not in Divi 4.27.3.

    ✅ Fix

    We have updated the version check logic to properly detect the parent Divi theme version, even when a child theme is active.

    Please apply the following changes in:

    language-switcher-for-divi-polylang.php

    1️⃣ Update the initialize_divi_5_module() function

    (around line 210–215)

    Replace it with:

    public function initialize_divi_5_module() { 
        $divi_version = self::get_divi_theme_version();
        if ( $divi_version && version_compare( (string) $divi_version, '5.0', '>=' ) ) {
            require_once plugin_dir_path( __FILE__ ) . 'divi-5/divi-5.php';
            new LSDP_Divi5();
        }
    }
    

    2️⃣ Add this new helper function in the same main file

    public static function get_divi_theme_version() {
        if ( ! self::is_theme_activate( 'Divi' ) ) {
            return 0;
        }
    
        $theme = wp_get_theme();
    
        // When active theme is a child of Divi, use the parent (Divi) theme version.
        if ( $theme->parent() ) {
            return $theme->parent()->get( 'Version' );
        }
    
        return $theme->get( 'Version' );
    }
    

    ✅ What This Fix Does

    • Correctly detects the actual Divi parent theme version
    • Loads Divi 5 module files only if Divi version ≥ 5.0
    • Prevents the RESTRoute class error on Divi 4.x
    • Works properly with child themes

    After applying these changes, you can safely reactivate the plugin.

    If you’d prefer, we can also provide an updated plugin version with this fix included.

    Please let us know how it goes.

    Thanks & Regards

Viewing 1 replies (of 1 total)

You must be logged in to reply to this topic.