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
- 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?
- PHP – redirect https to http and www to non-www
- Redirect to Page after Post Submit
- How to Join two tables from separate databases within WordPress
- Refresh page after update_post_meta
- Search and Replace in database: How to replace data in SQL dump file on Windows?
- Would manually deleting the dumping data fix a “#1062 – Duplicate entry ‘1’ for key ‘PRIMARY'” phpMyAdmin error?
- Import 10,000 Users into WordPress WITH a specific ID for each user
- Using a nonce in a Custom Login Form
- WP database error for comments_popup_link()
- Unusable menus and “Illegal widget setting ID: nav_menu_item[]” error
- Constructing a custom login form using ajax
- automated tests as a user?
- Logout and redirect using the WP Menu
- How to create Sub Sub domain Multi User blogs?
- How to generate page content from database the right way?
- Proper way to edit a post via phpMyAdmin without breaking the compare revisions tool
- Admin username and password
- Store and Work with huge array in WP [closed]
- phpMyAdmin displays error when importing database
- Adding Custom Forms
- How to get the POST TITLE using the POST ID?
- Why is the post meta[] empty when I make a call to the wordpress rest api?
- WordPress does not load page.php, return 404.php
- WordPress Scheduled Event Request Blocking
- How to give new users two specific user role options upon WordPress user registration
- Trying to establish connection to External Database
- Login/logout in header
- $wpdb->update with multiple parameters gives error
- Is it possible to create a wordpress database with php code?
- Store a default value for a transient on plugin activation
- Split reads to a different connection string
- custom user role wordpress – grant guest access to edit.php without insert/update/delete
- inserting a post from an extern php file but post content doesn’t show on wp site
- Having Issue on Redirecting With Session in WordPress
- Display Data in Table from External Database in WP using Shortcodes
- How to retrieve the data from the sever and displaying it in a page?
- Login redirect. Check user meta and redirect accordingly
- Saving data from custom form in wordpress database
- How to allow download url redirection only if user logged in WordPress site?
- PHP Redirect condition
- Get wp_current_user_id using PHP and MySQL
- PHP getting error when trying to access WP-Admin Dashboard
- If user is logged in not working
- Adding data to custom wordpress database table
- Add row to custom database Table and delete all rows older than 1 day
- select a single val though a table in wordpress
- WP insert post Redirect after function has executed
- Help with accessing wp-admin page and resolving error messages
- 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
- Using PHP Code Snippets to query a database, $dbconnection->get_results is outputting nothing
- Please help! I have a problem with getting wordpress databas
- 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
- Error establishing a database connection (configuration)
- Having trouble creating two shortcodes, one for logged in user and one for visitors
- Display specific page if user signed in
- Refresh page after login with litespeed cache
- Editing the term_order field
- Redirect after login depending on the URL
- WordPress database error only while loading page for 1st time
- Multiple WordPress sites with different theme and plugin sharing the same content
- How to grab data from input and store it into custom table in database?
- Insert data from form to database
- is_user_logged_in() not working in homepage
- How do I fetch a data from an external database into my wordpress homepage
- WordPress Redirect / Add_Rewrite_Rule – Non Index.php Page
- Full search and replace isn’t enough to make all pictures to be loaded with https
- Generate random access token to a post page
- I changed the password for the database user of my website, updated wp-config.php and wordpress asks to be reinstalled
- I want to use wordpress database in android app using json encode?
- redirect 301 with special character like WIX site “#!”
- Child theme functions.php file change database entries
- List users in a dropdown for login
- two wordpress sites, two themes, one database, same content
- White screen after login attempt
- Check if values exists DB
- MySQL database migration to WordPress
- Host does not allow remote connection, so how do I transfer data to my WordPress site?
- MySQL Engine vs. Charset
- Custom query_posts() parameter
- How to print array of specific item
- How to replace wp-admin login page to another location?
- Display total count of products in orders of a specific order status
- How do I do so that people can register on my wordpress site?