I already had this challenge before and here is my personal solution for you:
1. For the tag cloud widget you can use this approach:
add_filter('wp_tag_cloud', 'add_nofollow_to_tag_cloud');
function add_nofollow_to_tag_cloud($content) {
// Add 'nofollow' to the links
$content = str_replace('<a href="', '<a rel="nofollow" href="', $content);
return $content;
}
I already tested this locally and it works fine.

2. For the get_the_tags() function you can add this function:
add_filter('term_links-post_tag', 'add_nofollow_to_tag_list');
function add_nofollow_to_tag_list($tag_list) {
$tag_list = str_replace('<a href="', '<a rel="nofollow" href="', $tag_list);
return $tag_list;
}
Related Posts:
- Remove H1 site-tittle tag from product page with a function SEO
- Unwanted word behind my title in SERP
- Datetime on time tag wordpress puts it outside the tag
- NoFollow Entire Website
- Display list of most used tags in the last 30 days
- Check if current page has given tag ID
- Stop WordPress From Removing HTML Comments In Content
- How can I let my audience tag my posts?
- Query all posts with specific tag
- How to query with get_posts() for posts with any tag
- Change tooltip in tag cloud
- Getting an ordered list of tags – via wp_tag_cloud or not?
- Is it possible to filter get_adjacent_post() with tags?
- How to allow user to perform search by more than one tag
- Are Categories, Tags and Custom Taxonomies any different in regards to SEO?
- get_post_ancestors returns empty
- Combining tags from post types
- Display tags belonging to a specific post type only
- Creating a Lightweight Media Tags Plugin with a Custom Taxonomy
- Displaying the most recently used tags
- Limit tag word count
- Can’t Get ‘tag’ Page To Display only Tagged Posts
- Tags as a dropdown with set tags
- Efficient Tag Management?
- Get the latest tags in a cloud? [closed]
- Order tags by the order they were typed
- How to filter posts by specific date and its tag
- How can I show post excerpts on the tags page?
- Display posts count in front of the tag, for each tag
- Tags, use both union and intersection at the same time
- Get current tag list in Gutenberg save function
- Why does the count property of get_the_tags always return 0?
- How to add prefix or suffix to post_tag slug?
- Remove URL from Tag
- Get count of custom post tags
- Limit tag selection to predefined list
- WP API: Get posts excluding those with a tag or category name
- Change Post Class function
- Mass remove a number of tags from a number of posts
- Require tags for bbPress topics [closed]
- List posts from certain category, by tag
- WordPress Tag Page Hook?
- get postviews under every posts in the main page
- Tags not working with custom post type
- How can i order get_the_tags?
- How to exclude a specific tag from the list of tags for the current post?
- Add text to Title dynamically using tags
- Force meta data on specific product type
- Checking if one of the post tags has options
- How to get all the available post tags using the WP Data Module?
- How to add a rest field to post tags?
- How to get links to previous and next archive page based on tag
- Adding a H1 Tag to Post Tags automatically, but hide the tag? (Same for Category)
- How to make tag pages look as /tags/%tagname%/ in the URL?
- Remove ‘style=’ from Tag Cloud
- Order post by taxonomy
- Echo tags with an if statement and display php inside of the IF?
- Get Tag Slugs that start with a word
- Show all videos by tag name
- Print_r displaying two different post->ID if placed in sidebar or single.php
- Detect tag page and include an Image for that specific tag
- Buddypress – Adding Tags in Profile
- Setting up robots.txt with Yoast’s Seo plugin
- Do not run this code on posts with a specific tag!
- Automatically add tag (first 4 characters) to uploaded media
- How can I automatically hyperlink tag names that are in my post body to the tag page
- wp-cli error: “Term is missing a parent”
- Add a specific tag to default tag list
- Random tag in the post
- Remove little gray box from content page
- Get the publish date of the older post inside a tag
- How to test if the tag list is empty for the current page?
- Replace -tag in the_excerpt
- Get X post tags
- Can / should / how should I convert my WordPress categories to tags?
- Insert text BEFORE the “tag” title
- Title tag come up differently on search results
- Why doesn’t the_tags( ) accept empty string for first argument?
- tag based subscription
- Using heirarchial tags or Custom taxonomies
- Remove parentheses from tag cloud count
- the_tags outputs before echo
- Do not output category and tag URLs
- Only display posts with a specific tag
- Prevent tag creation on the post edition page
- showing tag beside catagory
- Conditional tag for attachment posts
- Get multiple tags by slug
- How To get a list of popular tags by post views?
- Post order by selected tags
- WordPress editor, change code wrap (bbpress?)
- Get TOP x Tags from selected posts
- post specific tag cloud, how to display in descending order from popular to less?
- Tags as autocomplete values
- Need to return all tags – including empty ones – in list
- How do I exclude categories from get_tags?
- How can I add meta tags in the WordPress header?
- How to have H1 for site title only on Homepage?
- Custom message if tag returns empty results
- What file is responsible with tags displaying on the post?
