If you look at canonical.php
you will notice that the wp_redirect_admin_locations
function is hooked very late– at priority 1000. This means that just about any function hooked to redirect_canonical
runs before this one. So, conditionally remove wp_redirect_admin_locations
from the template_redirect
hook.
add_action(
'template_redirect',
function() {
$requ = untrailingslashit($_SERVER['REQUEST_URI']);
if (site_url('login','relative') === $requ ){
remove_action( 'template_redirect', 'wp_redirect_admin_locations', 1000 );
}
}
);
Related Posts:
- PHP If user is logged in & on home page redirect
- Problem with login form
- How to redirect users based on role and content of redirect_to?
- Infinite loop when logging out using custom login form
- Need help with AJAX login to call php in functions.php to handle redirects based on user cap (role)
- wp-login.php?redirect_to=https problem
- Redirect users not logged in to the standard login page (and back) from some posts and pages
- wp_login_url always redirects me to wp-admin
- How do I make a redirect in PHP?
- User registration followed by automatic login
- Adding “Remember Me” in custom login
- How to change the wp-login.php page title?
- How build a custom login/register form with error handling?
- PHP – redirect https to http and www to non-www
- Redirect to Page after Post Submit
- How to redirect users to custom lostpassword page?
- WordPress 4 invalid username special charachters issue
- Is Auto Post recognition a WordPress feature? How to turn it off?
- Using a nonce in a Custom Login Form
- Constructing a custom login form using ajax
- automated tests as a user?
- Logout and redirect using the WP Menu
- Remove username in emails or swap username for email
- woocommerce and is_user_logged_in() if not redirect to homepage
- Check if user is logged in when clicking certain links on certain pages
- Admin username and password
- Is it necessary to sanitize wp_set_password user input?
- Woocommerce redirect thankyou page based on product ID doesn’t empty Cart
- WordPress does not load page.php, return 404.php
- How to give new users two specific user role options upon WordPress user registration
- Wp-login appears White Screen, Error: Cannot modify header information
- How to: PHP Log Out Link?
- Login/logout in header
- Programmatic Login from 3rd Party site
- Cannot access wp-admin/wp-login.php (WordPress backend) anymore, what could be wrong?
- WordPress homepage infinite redirect
- How to debug my custom login form looping intermittently
- getting logged in user info (wp-load.php) from parent directory
- How do I display the main domain for my WordPress install?
- Login to wordpress by clicking a link and specifying usernaname and password in url
- Log in / Log Out Custom Button
- Set Cache-Control header for 301 redirects
- Change CSS based on is_user_logged_in
- How can I open up my administrative panel to everyone?
- Showing latest post without 301 redirect
- Having Issue on Redirecting With Session in WordPress
- Using Argument from Function to Re-Direct Visitor (WordPress)
- How can I add a new row in a separate database when someone registers via WordPress?
- Login redirect. Check user meta and redirect accordingly
- Where to insert redirect code based on http_referer?
- Is this a correct usage of ob_start() in my WordPress project?
- How to allow download url redirection only if user logged in WordPress site?
- Lost in trying to create user database system
- Shortcode to log user into current URL
- PHP Redirect condition
- PHP getting error when trying to access WP-Admin Dashboard
- If user is logged in not working
- Change homepage content if user is logged in – BuddyPress
- Manually Create PHP Page For A Redirect
- Redirect to current user page upon link click
- Ajax URLs without #!, how to prevent falling into single.php on load or reload?
- Writing a link cloaking plugin
- WordPress permalink issue
- WP insert post Redirect after function has executed
- Help with accessing wp-admin page and resolving error messages
- How to redirect non logged in mobile users to page on same site?
- How to define a rule in functions.php that ONLY disables the default wp functionality that undesirably changes ‘&’ to ‘#038;’?
- Download file and redirect to page or vice versa
- Add more user roles to a PHP logout redirect function [closed]
- how can i redirect dynamic URL in worpress base on ID in htaccess or wp-config or function.php
- PHP warning – Use of undefined constant ‘FORCE_SSL_LOGIN’ ‘FORCE_SSL_ADMIN’ on wp-config.php
- How to block specific user id in custom login form?
- Log out without confirmation request (nonce)
- WordPress on Ubuntu – “File not Found” for home.php – Trying to Redirect to Root Folder
- Having trouble creating two shortcodes, one for logged in user and one for visitors
- Restrict wordpress access to logged users only
- Issues adding Recaptcha v3 to WordPress Registration
- Display specific page if user signed in
- WordPress: Redirect Main Site to Subsite in Multisite Where user is NOT logged in
- Refresh page after login with litespeed cache
- Redirect after login depending on the URL
- is_user_logged_in() not working in homepage
- WordPress Redirect / Add_Rewrite_Rule – Non Index.php Page
- Check if a user is logged into my WordPress site which is on a different server
- Newbie question. Login/Registration. New PHP page
- Submit to itself don’t work
- redirect 301 with special character like WIX site “#!”
- List users in a dropdown for login
- Not logged in when using http
- add bootstrap modal after login in wordpress
- White screen after login attempt
- 3 domains, 1 wordpress install, redirecting and changing domains on live site
- Get permalink for a post from inside WordPress and route to a related site
- How to replace wp-admin login page to another location?
- How to use multiple 404 Error Pages in WordPress
- login redirect based on user role not work as expected
- How to create a WordPress PAGE in another folder?
- Redirect loop upon installation of my plugin
- How do I do so that people can register on my wordpress site?
- change div text and link for logged in users