WPML root page

I’m having an issue in setting the root page in WPML (screenshot: https://cln.sh/ZHCM5p).
The root.php file exists in the main directory (same level as the composer and wp-config.php).
Problem is that i’m getting a white page when I set the path relative to the WordPress folder.

Anyone any tips/experience with this issue?

Try putting it under the web folder

If that works, you might want to generate web/roots.php dynamically during deploys.

I fixed this by using:

class WPML {

public function init() {
	add_filter( 'pre_update_option_icl_sitepress_settings', array( $this, 'change_root_path' ), 10, 2 );
}

public function change_root_path( $new_value, $value ) {
	$url = get_home_path() . 'root.php';
	$new_value['urls']['root_html_file_path'] = $url;
	return $new_value;
}

}

2 Likes

Would it be a good idea to add this to default Bedrock - or at least as a (mu-)plugin?

This topic was automatically closed after 42 days. New replies are no longer allowed.