Sauter la navigation
availability:

WPML Version: 3.2

description:

Returns the home url in the current language. To be used in place of get_option('home')

* Note: Good code will make use of get_home_url() or home_url() which apply filters natively. In this case there is no need to replace anything.

type:
filter
category:
Retrieving Localized Content
parameters:
apply_filters( 'wpml_home_url', string $home_url )
$home_url
(string) (Required) The home url from get_option('home')
hook example usage:

Example

$my_home_url = apply_filters( 'wpml_home_url', get_option( 'home' ) );
<a href="<?php echo $my_home_url; ?>">Home</a>

The example above will return http://siteurl/ for the default language as we would expect.
Then when we switch to a secondary language, i.e. German, the url will adjust and display as http://siteurl/de