Add the below code into your functions.php file
function redirect_login_page()
{
$login_page = home_url('/login/'); //your redirect page link here
$page_viewed = basename($_SERVER['REQUEST_URI']);
if ($page_viewed == "wp-login.php" && $_SERVER['REQUEST_METHOD'] == 'GET') {
wp_redirect($login_page);
exit;
}
}
add_action('init', 'redirect_login_page');
Related Posts:
- Changing user_nicename
- How to turn off redirection from ‘domain.com/login’ to ‘domain.com/wp-login.php’
- PHP If user is logged in & on home page redirect
- Is it necessary to sanitize wp_set_password user input?
- Problem with login form
- How to redirect users based on role and content of redirect_to?
- Lost in trying to create user database system
- 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)
- 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
- wp-login – unable to redirect user to a custom login url
- Redirect to current URL and append specified URL parameter on unsuccessful login through Elementor login form widget
- How to save checkbox values for logged in users?
- wp search-replace on database returns PHP fatal error: Array and string offset access syntax with curly braces is no longer supported
- How does WordPress know wich language is chosen when there is a database connection error
- 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
- How can I save unique user data on my site? [closed]
- Redirect undesirable domain
- Is it possible to create a wordpress database with php code?
- Update results, Before deleting the related category [closed]
- Store a default value for a transient on plugin activation
- getting logged in user info (wp-load.php) from parent directory
- How WordPress reacts to a lack of memory of the server [closed]
- Split reads to a different connection string
- custom user role wordpress – grant guest access to edit.php without insert/update/delete
- Execute long and heavy processes
- Dynamic content in template
- database sent to a JSON file
- How do I display the main domain for my WordPress install?
- inserting a post from an extern php file but post content doesn’t show on wp site
- Login to wordpress by clicking a link and specifying usernaname and password in url
- Using custom tables for old posts
- Databases – Submitting data from inputs to database [closed]
- db converts decimal number wrong
- Not connecting to database in file with multiple MySQL connections
- Log in / Log Out Custom Button
- Set Cache-Control header for 301 redirects
- Should `wp_login` be used since it’s deprecated?
- Moving code from theme header to functions.php
- Change CSS based on is_user_logged_in
- How to display login form anywhere, when user isn’t logged in, without redirecting?
- Filtering a Database Query
- How can I open up my administrative panel to everyone?
- Showing latest post without 301 redirect
- Having Issue on Redirecting With Session in WordPress
- Display Data in Table from External Database in WP using Shortcodes
- Is it best to avoid using $wpdb for security issues?
- How can I import an excel column into wordpress database?
- Blob file download problem
- WordPress Block developer from exporting Database via PHP
- How to retrieve the data from the sever and displaying it in a page?
- Using a $GET parameter from a URL, to redirect to a URL (WordPress)
- Execute a function every hour in the background
- Create page with custom php script and fetched data
- wpdb prepare insert table doesn’t work
- Should I use WordPress to skin a database website?
- How do I display offsite database info on my wordpress site?
- Creating Database Table vs. Adding MetaData to Post & User
- WordPress and MySQL: trying to print data using PHP from user_meta custom field data
- Building a REST API for your web app exposes primary keys of DB records?
- WordPress redirect redirecting too many times or not at all
- Most commented posts by time period (last 12h, last 24h and etc)
- Using Argument from Function to Re-Direct Visitor (WordPress)
- I am receiving a pluggable.php warning sign on my only http:// page
- 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?
- Saving data from custom form in wordpress database
- Is this a correct usage of ob_start() in my WordPress project?
- How can I find the cause of a 500 server error?
- How to allow download url redirection only if user logged in WordPress site?
- I can’t update my data through $wpdb
- wpdb Cannot Update column in Database
- Can’t successfully check if post with title exist in database
- Cant connect to database with php 7.3
- One account with multiple logins
- Delete database record using plugin from admin panel
- How to get image from url from the database?
- Set default Database Storage Engine when creating tables with plugins?
- Wpdb get->results to out the the month from the db
- Filter results from a serialized string to use on statistics
- How to add data to a custom field at the wp_users table?
- Creating custom page template from existing PHP site
- Shortcode to log user into current URL
- wordpress site – using custom database and PHP
- PHP Redirect condition
- Get wp_current_user_id using PHP and MySQL
- PHP getting error when trying to access WP-Admin Dashboard
- I installed WordPress locally now how do I login?
- If user is logged in not working
- WPDB – Read and write value from / to database
- How do I make this Metabox show current DB value?
- Change homepage content if user is logged in – BuddyPress
- Manually Create PHP Page For A Redirect
- How to Generate a list of Most Commented post?
- Why when I create a new post I found 2 record related to this post into the posts database table?