Set default language directory as root page in wpml

I will address setting the default language as root page using WPML. The first part will explain how the plugin handles multiple languages for a bit, if you are just interested in the solution scroll to the bottom of this article.

I have been building bi-lingual websites for a while, mainly with the help of the WPML plugin. It’s an awesome plugin that saves me a lot of the hassle required to build a multi-lingual websites.

WPML provides three ways to display your website’s languages:

  1. Each language in it’s own directory ex: (recommended)
  2. Different domain per language ex:
  3. Add language name as a URL parameter ex:

I have always used (and recommend) the first option.

It gives you the option to use or not use a directory for the default language, let’s say we have an English and Arabic website and English is the default language, you can have it like and

Or you choose not to use directory for the home page so it’s just the domain for the default language But I prefer to have a directory for the default language as well, that way it’s more convenient for the user.

Having a directory for each language raises the question of what to show in the root domain, without the language directory. WPML gives us the two options:

  1. A root page.
  2. Static HTML file.

The root page

This is a regular WordPress page that WPML will display when a user visits the root URL of your website, you may use it as a landing page that makes the user choose what languages does he/she want’s to visit.

Static HTML file

The same as the root page but using an HTML file on the server, instead of a WordPress page.

default language as root page

I wanted to have a directory for each language but at the same time, didn’t want to display a root page nor a static html file for the root URL. Instead, I wanted the root URL to redirect to the default language directory so when a user visits it automatically redirects to

There is no way to do so through WPML settings but we are able to do so using a custom WPML/Wordpress function, just copy the following snippet and paste it anywhere in your functions.php file

Now visit the root of your website and it should redirect to the default language.

If you have anything to add, let us know in the comments.

How to create a wordpress child theme

So you have just installed a new theme,everything is looking great except you want to modify it in a way or another. You have two options here.

Option one is to modify the theme files directly which will prevent you from updating the theme or else you will lose your modifications and if you don’t update your wordpress theme you are risking with getting your website hacked.

Option two is to create a child theme and put all of your modifications in it, this way you will always be able to update the parent theme without losing your modifications.

What is a wordpress child theme and how does it work?

You may consider the child theme as an additional layer on top of the actual – parent – theme, containing all our modifications.