WPML

Overview of the Issue

Enabling the “Directory for default language” option in WPML causes Tutor LMS course edit page URLs to break, resulting in the following issues:

  • The URL edit box contains a double slash (//) after the default language directory, e.g., https://example.com/it//courses/.
  • Saving changes to a course triggers the “Something went wrong” error.

Workaround

This issue is fixed in Tutor LMS v3.1.0. Updating solves it on your site, so you only need this workaround if you can’t update yet.

Please, make sure of having a full site backup of your site before proceeding.

  • Open …/wp-content/plugins/tutor/classes/Assets.php file.
  • Look for line 156.
  • Replace:
    return array(
    	'ajaxurl'                      => admin_url( 'admin-ajax.php' ),
    	'home_url'                     => get_home_url(),
  • With:
    //workaround compsupp-7724
    $wpml_fix_home_url = get_home_url(); // Default value
    if ( class_exists( 'SitePress' ) ) {
    	$wpml_settings = apply_filters( 'wpml_get_setting', false, 'urls' );
    
    	if ( isset( $wpml_settings['directory_for_default_language'] ) && $wpml_settings['directory_for_default_language'] == '1' ) {
    		$wpml_fix_home_url = site_url();
    	}
    }
    
    return array(
    	'ajaxurl'                      => admin_url( 'admin-ajax.php' ),
    	'home_url'                     => $wpml_fix_home_url,

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.