Robert Granlund
asked on
How do I exclude a category from the XML sitemap in Wordpress
Wordpress / Yoast. i have a lot of Draft Pages in my wordpress CMS. Yoast will not put them in the sitemap if I mark them to be excluded, but there are too many to go through. They are all in one category. I want Yoast to not place a specific category (or taxonomy, which ever is easier) in my XML sitemap. The reason is, Google will index Draft and private pages and I don't want that because they will come up 404.
How do I exclude a category from the XML sitemap in Wordpress
I found this but I dont think it is what I want
How do I exclude a category from the XML sitemap in Wordpress
I found this but I dont think it is what I want
/* Noindex all posts in a category */
add_filter("wpseo_robots", function($robots) {
if (is_single() && in_category(array(100))) {
return "noindex,follow";
}
return $robots;
});
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER