Replies: 0
Hello,
I am using this code to hide all taxonomies from xml sitemap that wordpress is generated:
function remove_tax_from_sitemap( $taxonomies ) {
unset( $taxonomies['category'] );
unset( $taxonomies['project_category'] );
unset( $taxonomies['project_tag'] );
return $taxonomies;
}
add_filter( 'wp_sitemaps_taxonomies', 'remove_tax_from_sitemap' );
I also have a number of posts and pages that are hidden with your Search Exclude plugin, mostly test post and pages,
but they are still visible in generated sitemaps:
https://musear-platform.com/wp-sitemap-posts-post-1.xml
As you can see I would like all those lorem ipsum posts to be excluded from sitemap.
I guess there must be a way to write a code
similar to the code above,
that will search for some meta key which is connected to all posts and pages where the “Exclude from search” box is checked.
And to remove those pages from sitemap.
U just dont know which meta key is the one I need,
and my knowledge in coding is a little bit limited so I need a help with this one,
to write a code.
Thank you for the great plugin,
Sanja
QUESTION UPDATE:
I just found this topic, some of the facts there could help with my question:
https://wordpress.org/support/topic/queryable-in-wp-db/
So, array of excluded posts ids is this:
$excludedPostIDs = get_option('sep_exclude', []);
How can I use it to exclude form xml sitemap all those posts from that array?
Thanks,
Sanja