Skip to content

Instantly share code, notes, and snippets.

@al5dy
Created July 14, 2016 19:07
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
  • Save al5dy/d43783e435b27b29b2e75dfa3fe527f6 to your computer and use it in GitHub Desktop.
Save al5dy/d43783e435b27b29b2e75dfa3fe527f6 to your computer and use it in GitHub Desktop.
Yoast SEO - убираем теги <image:image> для Yandex
function yoast_clear_sitemap( $output, $url ) {
$timezone = new WPSEO_Sitemap_Timezone();
$date = null;
if ( ! empty( $url['mod'] ) ) {
$date = $timezone->format_date( $url['mod'] );
}
$url['loc'] = htmlspecialchars( $url['loc'] );
$output = "\t<url>\n";
$output .= "\t\t<loc>" . $url['loc'] . "</loc>\n";
$output .= empty( $date ) ? '' : "\t\t<lastmod>" . htmlspecialchars( $date ) . "</lastmod>\n";
$output .= "\t\t<changefreq>" . $url['chf'] . "</changefreq>\n";
$output .= "\t\t<priority>" . str_replace( ',', '.', $url['pri'] ) . "</priority>\n";
unset($url['images']);
$output .= "\t</url>\n";
return $output;
}
add_filter( 'wpseo_sitemap_url','yoast_clear_sitemap', 10 , 2 );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment