-
Harris ha publicado una actualización
Cómo eliminar los índices de tipos de post específicos de Yoast sitemap_index.xml
I used Yoast’s API to create a custom XML sitemap that combines all of my website pages and a few other post types into one. I do the same thing for translated pages so that they are in their own sitemap.
I want to remove the Yoast-created XML sitemaps from the sitemap_index.xml so only my custom sitemap is there. I cannot find any references to how to accomplish this. I tried using the
wpseo_sitemap_exclude_post_type
filter to remove the post types for the other sitemaps, but doing so removed my custom sitemap from the sitemap index as well (since it is comprised of the same post types that I excluded).Is there any way to do this?
stackoverflow.com
Stack Overflow | La mayor comunidad en línea del mundo para desarrolladores
Martin-
Puede utilizar el siguiente código en el archivo functions.php:
function yoast_sitemap_exclude_post_type_sp( $value, $post_type ) {
// eliminar post_type : producto, post, página
if ( $post_type == 'producto' || $post_type == 'post' || $post_type == 'página') {
devuelva verdadero;
}
}
add_filter( ‘wpseo_sitemap_exclude_post_type’, ‘yoast_sitemap_exclude_post_type_sp’, 10, 2 );
[enter image description here][1]
-
@ava-martin How does this solve the issue? Please explain what you’ve you changed to address the issue.
Also, I mentioned in my description that I already tried using the wpseo_sitemap_exclude_post_type filter to exclude the “page” and “people” post types, but doing so caused my custom sitemaps to disappear from the index as well. 😅
-
-