wpseo_xml_sitemap_post_url
Filter the URL Yoast SEO uses in the XML sitemap.
Note that only absolute local URLs are allowed as the check after this removes external URLs.
Использование
add_filter( 'wpseo_xml_sitemap_post_url', 'wp_kama_wpseo_xml_sitemap_post_url_filter', 10, 2 ); /** * Function for `wpseo_xml_sitemap_post_url` filter-hook. * * @param string $url URL to use in the XML sitemap * @param object $post Post object for the URL. * * @return string */ function wp_kama_wpseo_xml_sitemap_post_url_filter( $url, $post ){ // filter... return $url; }
- $url(строка)
- URL to use in the XML sitemap
- $post(объект)
- Post object for the URL.
Где вызывается хук
wpseo_xml_sitemap_post_url
yoast/inc/sitemaps/class-post-type-sitemap-provider.php 626
$url['loc'] = apply_filters( 'wpseo_xml_sitemap_post_url', get_permalink( $post ), $post );