-
Harris publicou uma atualização
Como remover índices de tipos de posts específicos do sitemap_index.xml do Yoast
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 | A maior comunidade online do mundo para programadores
Martin-
Pode utilizar o código abaixo no ficheiro functions.php:
function yoast_sitemap_exclude_post_type_sp( $value, $post_type ) {
// remove post_type : product, post, page
Se ( $post_type == 'product' || $post_type == 'post' || $post_type == 'page') {
devolva verdadeiro;
}
}
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. 😅
-
-