wpml_alternate_hreflang
- Category
- Site-Wide Language Information
- WPML Version
- 3.3.7
Description
This filter receives the URL to be filtered, as well as the corresponding language code.
Example usage
$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:
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 );
Related hooks
wpml_decode_custom_field, wpml_footer_language_selector, wpml_add_language_form_field, wpml_ls_exclude_in_menu, wpml_is_rtl, wpml_head_langs, wpml_must_translate_canonical_url, wpml_browser_redirect_language_params, wpml_active_languages, wpml_encode_custom_field