- availability:
-
WPML Version: 3.3.7
- description:
-
This filter receives the URL to be filtered, as well as the corresponding language code.
- type:
- category:
- Site-Wide Language Information
- parameters:
- hook example usage:
-
1
$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:
1234foreach
(
$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
);