I would actually suggest an alternative approach – remove the function that causes the redirect in the first place:
function wpse_227033_disable_name_redirect() {
if ( is_404() && isset( $_GET['name'], $_GET['instID'] ) )
remove_action( 'template_redirect', 'redirect_canonical' );
}
add_action( 'wp', 'wpse_227033_disable_name_redirect' );
I’ve used the wp
hook which runs pretty much just before template_redirect
. Remember you’ll need to clear your browser cache before testing (those redirects are 301
‘s).
Related Posts:
- Redirect to post after submission with Gravity Forms? [closed]
- Wp Login redirect strips parameters from url
- Change gravity forms confirmation redirect query string to include entry id [closed]
- Adding query string parameters to URL with same name as custom post type gives 404 error
- Site using static homepage, redirects (301) and removes pluses from query string
- Redirect to dashboard after login
- Make a video post redirect to next post after completion
- Site redirects to wrong url when saving settings
- How can I include a query string with get_permalink
- WordPress Redirect based on the prescence of a cookie
- Redirect to “All Posts” after post update or publish in Block Editor
- Redirect user after login/registration globally
- Redirection errors
- WordPress CMS – hide content from public while in editing stages
- Redirect to a page after a few seconds
- How to redirect only if page doesn’t exists
- htaccess redirect – directory and subpages to a single page
- Plugin for conditional redirect
- url keeps redirecting to a page
- https multiple redirects
- Redirects from Tumblr to new WP
- Why does multisite bypass WordPress for wp-content, wp-admin, wp-includes and .php files?
- Redirecting to old domain, tried everything, nothing works
- How to modify the Register link in the login page?
- Changing “Lost Password Email Link” to custom password reset page
- Why does wp_redirect strip out %0A (url encoded new line character) and how do I make it stop?
- htaccess redirect – replace special character
- Redirect Logged In User if page is wp-login.php and $_Get[‘level’] = X
- WordPress url incomplete redirects to first article with that name
- Right hook to redirect frontend visitors while respecting rest api plugins to run first?
- Create a page that automatically redirects to latest post of a specific tag/category?
- Is it possible to incorporate username in a login redirect?
- Changing domain
- How to redirect on login to a specific page if a specific meta user is empty
- Redirecting amp url to non amp url
- How To Redirect /url.html to /url?
- Redirect htaccess does not work correctly with my new wordpress site
- Redirecting deleted posts url to another WordPress install
- Redirect – remove custom query string
- 301 redirect from old URL structur to new
- Custom redirect user after login based on metadata
- wp_redirect () doesn’t work in nginx?
- Add Username to URL for redirect
- Log out and redirect to different URL
- How to get better performance for redirect from domain.tld/35 to domain.tld/full-permalink?
- I want to resolve Redirect Chain [closed]
- How to fix URL with pageid example /?p= too many redirection error
- Display Freebie Page Content only if Referrer is from Form Page
- Create header.php redirect in WordPress and with WPML
- simple wordpress form redirection
- Redirect to home if page doesn’t exists [duplicate]
- Redirect all links form a category to new links on new category
- Site Address and WordPress Address settings when using a load balancer
- Cannot install wordpress, /wp-admin/install.php, inproper redirection [closed]
- Prevent “/login” to redirect to “/wp-login”
- Redirect home resets (qtranslate) language
- How to redirect logged out users to specific page?
- Redirect certain pages if user logged in
- Login redirect shows white page in firefox
- wp_login_form redirect
- How can I disable redirect domains?
- When i try to enter subdomain i’m redirected to main domain
- Change my URL from https://www.domain.com to https://domain.com
- 301 all old pages to new location
- Use a 301 to Redirect any 404 from at the blog post level to the blog archive
- How do I share a site only to one User at the time? Please help π₯Ίπ
- Re-Direct ALL Users to the Home Page IF not logged in
- Need to redirect home page only on Woocommerce site if user logged in
- Redirect to dashboard user once you click on Publish page
- Author Archive Page redirecting issue
- Understanding Redirects
- Changing auth_redirect() page
- Why https://www. SUBdomain is redirected by WP to https://MAINdomain
- Page editing in backend redirecting to 404 page not found with url /post.php
- wordpress redirect error in xampp
- Redirect based on referer using Advanced Custom Fields
- Swapping current old site to new WordPress site – need to check I’m doing it right
- Redirect User to Specific Page
- How to redirect a referal url to a signup page?
- Allow GET request on certain page
- How to modify the WordPress comes with redirect
- Conditional redirect on login using referring URL
- PHP Mistake – Whats wrong here?
- On login redirect to different homepage if user is using a mobile
- Multisite hide subdirectory
- WordPress update 4.4.1 redirect loop
- Redirecting Issue
- How to redirect correctly a root domain to a subdomain in a subfolder?
- 301 redirect for wordpress permarlink
- login_redirect for Mobile Web
- Need rewrite for URL with specific string
- Redirect to 404.php from single.php
- How to make my homepage automatically redirect to an external website?
- How does the flow of htaccess files in sub-directories work
- Redirect to a subdirectory frontpage using without using a WP plugin- what files to edit, and how?
- How to Show different page URL instead of default home page URL
- How to Redirect Url to homepage?
- 404 Not Found with All Cloaking plugins
- How to redirect users without permission to view content to a custom page?
- redirect the root of a domain, while leaving the www version unredirected