Since I have less reputation I can’t comment, this is not answered with code but wanted to help, you may check this plugin: https://wordpress.org/plugins/redirect-404-error-page-to-homepage-or-custom-page/ or just take required code from the plugin ( I am not connected with that plugin anyway )
Related Posts:
- base directories / URL
- Custom Taxonomy leads to 404 page
- How to show taxonomy on front page
- All tag/category/custom taxonomy archives 404
- How to manage the links of a new taxonomy
- Why do my offline development site and online live site behave differently?
- Pages throwing 404 error on server load
- Taxonomy link not working (leads to 404 page)
- How to add a default item to a custom taxonomy?
- Automatically Assign Parent Terms When A Child Term is Selected
- get term by id without taxonomy
- Taxonomy terms sort by… Last name!
- get_terms with posts that have a different taxonomy with term x
- Multisite 404 errors and non-www redirecting to home page
- Where does the 404 redirection happen?
- Count posts for each taxonomy term for each month
- Filter blog archive by category in URL
- Trying to list terms of a custom taxonomy using get_categories
- Check if post is in draft or pending review?
- taxonomy/category term in URL slug irrelevant for post?
- How to use a Term Meta Field as a link
- Embed YouTube video on category description
- Manually query posts by taxonomy with MySQL
- Show only, when taxonomy has posts?
- Convert Custom Post Types to Custom Taxonomies
- How do I query a taxonomy term range
- Defining a custom 404 for non-WordPress parts of site
- get_terms problem : related articles
- Redirect parent taxonomy to it’s child
- Why “Warning: Invalid argument supplied for foreach()”
- WordPress User Taxonomy Saved Values
- Display Taxonomy Description on edit-tags screen?
- How to display terms from a custom taxonomy in a hierarchy AND with custom html markup?
- jQuery Ajax returning correct Response, but after redirect to 404 Error
- get_the_terms error
- How can I find the taxonomy in edited_{taxonomy}?
- Pulling Data from CSV vs. pulling data from database
- Attaching taxonomy data to taxonomy with wp_insert_post
- Problem with orderby
- Problem with Query on Taxonomy
- Taxonomy archive + query attachments = duplicate results
- Exclude posts which have any term in a certain taxonomy from the query
- Page not found for custom post type UI plugin and taxonomy
- Comma separated tax terms, with “and” before last item [duplicate]
- How to add and display a taxonomy term image in any template? (Taxonomy Images)
- I used single quote to design HTML of my WordPress blog. Now site redirects to index.php everytime than page.php or single.php
- Taxonomy term page going to 404
- Get Link to Feed On Term or Taxonomy
- Categorize wordpress tags
- How can i count post from my post type taxonomy
- Creating links to a page displaying posts from a particular category
- Custom taxonomy template list not working (404)
- Blogroll links sorted by category in a table
- Custom taxonomy template shows 404 Error
- How to relate a user object to taxonomy term?
- Filtering elements by taxonomy slug
- How to redirect non existent pages/posts in wordpress using htaccess
- Taxonomy vs Post Status
- Get terms in hierarchical taxonomy
- Declaring arguments for taxonomy
- Prevent certain subscribers from seeing specific taxonomies (changes frequently)
- Replacing a placeholder term with a session variable value in taxonomy filter
- child_of not working in wp_dropdown_categories
- How to display posts from two taxonomies?
- Using taxonomies to handle layout?
- Loop problem – Taxonomy
- Return single taxonomy term outside the loop
- How to embed the Taxonomy Admin screen in to a Tab of a Settings Page in a plugin
- Calling an Archive Page with specific Tag/Tax ID
- Assign Multiple Values from Post Fields to Taxonomy Terms
- how can send a parameter by click on gender-link to filter a post by gender and product taxo
- Taxonomy terms are not checked when edit custom post
- Checking if a product ID has taxonomy term attached not working with has_term
- Can I create a tax query to return posts that match two slugs from same taxonomy
- How best to add Author or Artist to product
- Display related terms from a taxonomy in an entry
- Order custom taxonomy hierarchy
- Including taxonomy in searches
- Different Sidebar for same Taxonomy
- How Do I Register Two Taxonomies with one Parent of the Other?
- What is this Query? and why its taking too much time? Any way to optimize it?
- Translation ready code format for taxonomy
- Create multidimensional array of taxonomies
- how to display taxonomy name in do shorcode php tag
- Can I have have terms with the same slug in the same taxonomy?
- How to customize taxonomy edit page
- Categorizing posts by location
- How to filter the terms to a special custom taxonomy?
- GET Taxonomy ID
- How can I create gallery of products and submit data for each product?
- Why can’t I exclude a term ID from either get_terms or WP_Term_query?
- get_term_link doesn’t work
- What is the ‘selected’ parameter in wp_dropdown_categories() for?
- Taxonomy works in local XAMPP but doesn’t work live
- I need to add new menu item inside the custom post admin menu
- Append taxonomy url
- get_terms of specific parent (including the parent itself)
- Add URL field to wordpress taxonomy
- Display taxonomy terms when adding a link in the admin
- Bulk import in custom taxonomy