Skip Navigation

Resolved by author

Resolved in: Tutor LMS v3.1.0

Topic Tags: Compatibility

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

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,
    

Leave a Reply

Please stay on topic and be respectful to others. If you need help with issues not related to this post, use our Support Forum to start a chat or submit a ticket.

You can use these tags:
<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>