Tags don’t create duplicate posts, so the likelihood of them hurting your SEO by appearing in a sitemap are slim.
You can add a filter to the return of the taxonomies sitemap to remove tags. This is just a quick attempt I threw together. I haven’t tested it but it should provide a basis to work from at the very least.
function remove_low_tags($taxonomies) {
//create a new array of tags with count above 2
array $allowed_tags;
//loop through current array of tags and add them to $allowed_tags if they are > 2
foreach ($taxonomies as $tags) {
if (count($tags) > 2) {
$allowed_tags[] = $tags;
}
}
return $allowed_tags;
}
add_filter('wp_sitemaps_taxonomies', 'remove_low_tags');
Related Posts:
- Can’t seem to get an else statement correct? [closed]
- Posts with at least 3 tags of a list of tags
- How to force a query conditional?
- Better way to get tag stats?
- Given a WP_Query, how can I get a list of tags?
- Executing Queries in tag.php
- How to order posts tag by tag?
- post_type is ignored by WP_Query when ‘tag’ argument is included
- WP Rest API v2 return posts with specific tag
- Loop through all tags & output posts in alphabetical list
- Order posts by tags count?
- How to get any tag ID
- Get all posts without tags
- WP Query for Posts (Products) in Specific Category that has 2 Specific Tags (*AND* both tags not *OR*)
- Targeting specific pages in the loop
- How to exclude products by tag from woocommerce shop page?
- Pagination problem after WP_Query with tag filtering
- How to check if a post “does not have term” in conditional statement?
- Query post from all category with same tag on 1 pages
- reducing the amount of wp_query calls
- WordPress Related Post by tags in Single.php
- How to build a WP_Query using mulitple tags and using AND or OR operator between them
- Include tags in WP_Query
- Search for multiple tags?
- Display posts from only one post form in custom query and exclude in main query
- Set conditional on template based on referring page slug
- How can I make WP_Query get posts that have a tag but also have random other tags?
- Cluster WooCommerce products in each Category Archive by Tags assigned to products
- Display tags with random thumbnail from selection of posts with that tag
- Query posts intersecting tags and categories
- Combining categories (Query posts with multiple taxonomy terms)
- Inserting HTML to close and open divs in WP_Query loops
- Order by most used tag
- WP Query with multiple tags by get the tags
- Is_single() conditional tag returns null in query
- WP_Query and is_page_template() conditional
- Show a 404 error page if Public query variable’s value doesn’t exist?
- Query Posts by Tag and exclude
- For what queries is conditional tags informative?
- Get posts that do not have the same tags as current
- Should $query-> be used with conditional tags?
- exclude product with available tag
- WP_Query by keyword OR post tag
- Display posts by tag
- Creating attachments archive in tags and categories
- Get posts with no tags?
- ajax wp_query conditional tags not working
- Filter products on category AND tag
- Only show tag with the same id as the post
- Get posts that match defined arrays of tags
- Order posts by tags count?
- Fix wp_term_relationships slow query in get_posts
- getting posts by tags
- Search with WP_Query, but ignore href URLs in anchor tags?
- Show posts from categories instead of tags
- post_type not working when tag__in is present?
- Related Post by Tags Code
- Exclude all tagged posts from WP_Query loop
- I cannot get tax_query in get_posts() to work with custom taxonomy
- WordPress custom query by archive title
- How to create page that lists tags by initial letter?
- How to make a wordpress loop file that displays posts based on certain conditions
- Random posts in WP_Query when searching by tag
- Issue attempting a wp_query_posts with tags
- Conditionals in WP_Query
- Limit Tags display and ad Drop Down Menu
- Get posts that were most recently tagged
- How do I show related posts from categories instead of tags?
- When should you use WP_Query vs query_posts() vs get_posts()?
- When to use WP_query(), query_posts() and pre_get_posts
- WP_Query by just the id?
- Meta_query compare operator explanation
- WP_Query with “post_title LIKE ‘something%'”?
- wp query to get child pages of current page
- How to get an array of post data from wp_query result?
- How to get post id of static front page?
- meta_query with meta values as serialize arrays
- How to only display posts whose meta_value field is not empty?
- Get post ids from WP_Query?
- Pagination when using wp_query?
- Exclude post ID from wp_query
- How to print the excuted sql right after its execution
- How to extend WP_Query to include custom table in query?
- How to store and receive variables in WP sessions?
- Should I use Pre Get Posts or WP_Query
- How can i retrieve default post per page value? from settings->reading. And total number of posts?
- Nested meta_query with multiple relation keys
- Is it necessary to use wp_reset_query() in a WP_Query call?
- Can I force WP_Query to return no results?
- Can wp_query return posts meta in a single request?
- Using pre_get_posts with WP_Query
- Find out total number of pages in global query on archive page?
- WP_Query + random
- Resetting post data to previous loop in nested loops
- order by numeric value for meta value
- numberposts? showposts? posts_per_page?
- $GLOBALS[‘wp_the_query’] vs global $wp_query
- Broken? WP_Query and “attachment” as a post type
- Some doubts about how the main query and the custom query works in this custom theme?
- Order by multiple meta key and meta value [closed]