pll_home_url

Returns the home url in the current language.

Description

(string) pll_home_url( (string) $lang = '' ); 

Returns (string)

Parameters (1)

0. $lang — Optional. (string) => ''
Language code ( optional on frontend )

Usage

  1. if ( !function_exists( 'pll_home_url' ) ) { 
  2. require_once ABSPATH . PLUGINDIR . 'polylang/include/api.php'; 
  3.  
  4. // language code ( optional on frontend ) 
  5. $lang = ''; 
  6.  
  7. // NOTICE! Understand what this does before running. 
  8. $result = pll_home_url($lang); 
  9.  

Defined (1)

The function is defined in the following location(s).

/include/api.php  
  1. function pll_home_url( $lang = '' ) { 
  2. if ( empty( $lang ) ) { 
  3. $lang = pll_current_language(); 
  4.  
  5. return empty( $lang ) ? home_url( '/' ) : PLL()->links->get_home_url( $lang );