WPML
apply_filters( 'wpml_home_url', string $home_url )
Type
filter
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.

Arguments

$home_url
(string) (Required) The home url from get_option('home')

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

wpml_media_url, wpml_media_id, force_suppress_filters, wpml_get_translated_slug, wpml_translate_single_string, wpml_translate_string, wpml_elements_without_translations, wpml_permalink, wpml_unfiltered_admin_string, wpml_element_link

All 12 Retrieving Localized Content hooks →