The normal practice for creating a link to the home page used to be to insert this in your theme (normally in header.php):
<a href="<?php echo get_option('home'); ?>/" >
It generates a link that points to your site’s home address. Since that address is stored in WordPress without a trailing slash “/”, this code also adds that trailing slash. Without it, WordPress would redirect internally, causing a double access for every click on the home page.
When you are using WPML, the home page address is modified per language. Some addresses already contain the trailing slash “/” and others do not. If you keep the normal home page link, you will get double trailing “/” signs for some of the home pages. For example, your homepage in Spanish language could end up like this:
To avoid this, we suggest using a new filter available since WPML 3.2 version, wpml_home_url. It will point to the right home address and automatically use the correct trailing slash. For example, You can use something like the following:
<?php $my_home_url = apply_filters( 'wpml_home_url', get_option( 'home' ) ); ?> <a href="<?php echo $my_home_url; ?>">Home</a>
The following is an example of the icl_get_home_url hook usage:
<a href="<?php echo icl_get_home_url() ?>" >
Using native WordPress hooks to get the home URL
As WordPress evolved, we also added support for its native hooks which makes the usage even easier. For example, native WordPress hooks like get_home_url() or home_url() filter your URL per language by default. This means you can use them directly, like this:
<?php echo esc_url( home_url( '/' ) ); ?>Home</a>
Please, keep in mind that other WordPress hooks like site_url(), get_option(‘home’) and get_option(‘siteurl’) are not filtered automatically. If you decide to use these hooks, use our wpml_home_url filter for translating the site’s home address.