Sounds like an easy task to do. I think hooking into ‘template_redirect’ and conditionally triggering redirect is the way to go.
EDIT: Seems is_tag() isn’t reliable once 404 is triggered. That’s why we need to look into the query vars to figure out if it’s really a tag query or not.
function redirect_404_tags_wpse67077() {
global $wp;
if ( ! empty( $wp->query_vars['tag'] ) && is_404() ) {
wp_safe_redirect( home_url("https://wordpress.stackexchange.com/"), 301 );
exit;
}
}
add_action( 'template_redirect', 'redirect_404_tags_wpse67077', 1 );
Related Posts:
- Redirect Tag to Post with the same name
- Problem using the word “RSS” as a tag
- htaccess redirect for all categories converted to tags now showing 404
- how do I get the tag name from tag id?
- Do tags have dates?
- Display tags in list without link
- How can you tie into the tag metabox?
- How to display the_tags() as plain text
- Multisite 404 errors and non-www redirecting to home page
- Display tags for current post in sidebar
- How important are WordPress tags for SEO purposes?
- How do I skip wordpress’s 404 handling?
- Allow visitors to search by multiple tags (specific IDs)
- How do I redirect all 404 errors of a specific post type to another URL?
- Where does the 404 redirection happen?
- Massive Tags Remove Using MySQL
- Quicktags on all textarea.. Not working on plugin?
- how to change # of tag posts on /tag page?
- How can I remove certain HTML tags from the RSS feed?
- Stop WordPress removing tags when switching from HTML to Visual (TinyMCE)
- Link directly to the first post in an archive
- Set homepage to only display posts from one tag
- Strict tag list – user should choose only existing tags for posts
- Special characters in tag get removed for comparison on save
- Display custom list of tags in post/page editor with hooks
- Displaying Posts by tag dynamically in WordPress
- WordPress blocking/preventing viewing of .cgi file in subdirectory [closed]
- How to rename ‘TAG’ to ‘TOPIC’
- How to not show tags if the post doesn’t have any?
- Don’t show a tag on a post if it is the only post with that tag
- Remove the last character from tag name in tag archive page
- How to Override “Blog pages show at most” in tag.php [duplicate]
- WordPress editor: “pick from existing tags” is gone?
- WordPress does not load page.php, return 404.php
- jQuery Ajax returning correct Response, but after redirect to 404 Error
- Custom Permalink
- Get tags for post_type
- Line of Tag information Is Formatted Strange
- How can I make an auto-fill search box auto-completing with the tags?
- WordPress Auto-Redirecting on 404
- How to get the Tags on Publish post hook?
- woocommerce product tags display
- TinyMCE – how to select tags node from the place where the caret is?
- List tags by certain letter issue with special chars like å, ä and ö
- Strip and tags from a specific div
- Require tags for bbPress topics [closed]
- How to enable all Tag Descriptions in loop?
- Tags not working with custom post type
- I used single quote to design HTML of my WordPress blog. Now site redirects to index.php everytime than page.php or single.php
- How to redirect an old page url to the homepage
- “ Language notation in the post content
- Expired event redirect to parent category
- How to make tag pages look as /tags/%tagname%/ in the URL?
- 404 redirect based on url
- WordPress tags as twitter sharer URL hastags
- Get Tag Slugs that start with a word
- Add post tag without post id
- Show all videos by tag name
- A change in URL slug in database returns 404, how can I do auto-redirect?
- Changing H1 to Normal Links
- 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
- 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”
- Random tag in the post
- Remove little gray box from content page
- Get the publish date of the older post inside a tag
- Redirect to /404/
- How to test if the tag list is empty for the current page?
- Get X post tags
- Can / should / how should I convert my WordPress categories to tags?
- Insert text BEFORE the “tag” title
- Display a custom 404 page without a redirect
- tag based subscription
- How do I skip wordpress’s 404 handling?
- Remove parentheses from tag cloud count
- the_tags outputs before echo
- Only display posts with a specific tag
- Prevent tag creation on the post edition page
- showing tag beside catagory
- 404 error when i try to search by category or by tag
- 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
- Subdomain add comment redirect to 404 not found page iis server
- 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
- Why when I click on a link into the WP admin panel I am redirected to a link that doesn’t contains wp-admin prefix, so I obtain 404 error
- How to make attachment tag archive visible on page
- What file is responsible with tags displaying on the post?