WPML
PHP
wpml_alternate_hreflang

Description

This filter receives the URL to be filtered, as well as the corresponding language code.

Example Usage

PHP
$alternate_hreflang = apply_filters( 'wpml_alternate_hreflang', $lang['url'], $lang['code'] );

To filter the HTML of the produced set of link tags with you can use the following code:

PHP
foreach ( $hreflang_items as $hreflang_code => $hreflang_url ) {
	$hreflang .= '<link rel="alternate" hreflang="' . esc_attr( $hreflang_code ) . '" href="' . esc_url( $hreflang_url ) . '" />' . PHP_EOL;
}
echo apply_filters( 'wpml_hreflangs_html', $hreflang );