Skip to content
Read For Learn
Read For Learn
  • Database
    • Oracle
    • SQL
  • C
  • C++
  • Java
  • Java Script
  • jQuery
  • PHP
Read For Learn
  • Database
    • Oracle
    • SQL
  • C
  • C++
  • Java
  • Java Script
  • jQuery
  • PHP

force login and redirect to custom login page

If you’re willing to try another plugin, I suggest using Force Login. It’s a simple lightweight plugin that will require all visitors to login.

Once the plugin is installed and activated, add the following code to your functions.php file to change your site’s login URL to point to your custom login page:

function my_login_page( $login_url, $redirect ) {
    return site_url( '/haendler-login/?redirect_to=' . $redirect );
}
add_filter( 'login_url', 'my_login_page', 10, 2 );

Related Posts:

  1. gravity form login widget redirect
  2. wp_redirect not working after submitting form
  3. Where does wp_redirect need to be placed to make it work?
  4. How to 301 private posts rather than 404?
  5. Redirect on successful login
  6. Need help to repair a 301 redirect problem
  7. Action wp_login_failed not working if only one field is filled out
  8. Passing User Messages to Another Page
  9. How to disable redirect on test/staging copy of wordpress site
  10. Redirect user after login/registration globally
  11. wp_redirect not working when going to www version of site
  12. Cannot get redirect working
  13. Custom pagination structure
  14. wp_redirect “headers already sent” after front-end submission form
  15. Controller functionality – if user is not logged in send them to specific page (not wp_login)
  16. wp-admin Redirects to Docker Container Name
  17. How to auto login after registration? [duplicate]
  18. Redirect to Referring URL after Login
  19. Why “exit” is needed after wp_redirect?
  20. Restricting frontend acess based on user role otherwise redirect to login form
  21. wp_redirect not working in header, exit is breaking page
  22. how to block direct access to multiple thank you pages?
  23. Redirecting Subscriber Users to the home page after updating their profile
  24. wp_redirect not working from shortcode function
  25. Problem with is_page & wp_redirect
  26. Why is the session clearing after wp_safe_redirect?
  27. How to fix Ahref error showing wordpress admin pages as “Duplicate pages without canonical”?
  28. Problem in redirect link in wordpress
  29. Fix a Permalink plugin: it miss the redirect from old to new permalink
  30. Redirect Non-Logged In Users to Specific Page based on Page Template
  31. How to redirect non-logged in users from a URL to a specific page?
  32. Proper way to set author pages at root?
  33. How to Manually Upload Files via FTP
  34. Redirect to specific page
  35. blog url redirecting
  36. Redirect wp-login
  37. How to do 302 redirects “in” WordPress using Redirection plugin? [closed]
  38. wp_redirect giving a warning: Cannot modify header information – custom plugin
  39. Redirect outside WP after login
  40. Can I trust user input in wp_redirect()?
  41. redirect to /wp-admin/edit.php instead of wp_redirect url
  42. WordPress wp_redirect() not working after get_header();
  43. Redirect specific link for logged in users only to specific URL
  44. Redirection problems
  45. Use wp_redirect without filter in plugin file
  46. Redirect to Page URL for non-members
  47. How to redirect to cart page using wp_redirect [closed]
  48. WP Redirect is not working
  49. Redirect regex misbehaving when placeholder empty
  50. Redirect to first child in menu
  51. Why does user not logged in when using wp_signon function
  52. Website URL not getting updated
  53. wp_redirect and get variables
  54. Force Rewrite Query Var On Hierarchical (Nested) Page
  55. Strange redirect behavior after moving development site to client server
  56. how to use wp_redirect inside a function
  57. wp_redirect hangs, but returns true
  58. How we redirect to other pages in WordPress?
  59. Question about proper use of wp_redirect?
  60. Checking if a user is logged in, if so redirect to a different page
  61. How do you maintain a debug session after wp_redirect()?
  62. Infinite redirect loop in my local environment
  63. Why sometimes wp_redirect() reset cookie?
  64. wp_redirect is not working sometimes
  65. Staging redirecting to live site (under construction page)
  66. Custom Login page, redirection and restrictions
  67. Redirect Users who aren’t logged in, aren’t post authors and aren’t admin. Frontend
  68. Problem in auto login after registration
  69. Looking to redirect a link
  70. How Do I Redirect a WordPress Website?
  71. Overiding wp_sanitize_redirect for | character
  72. Frontend registration form doesn’t save data only redirects to wp-login
  73. changing products urls – redirects
  74. How to redirect single post to parent category
  75. Using wp_login vs login_redirect to redirect based on user-meta
  76. Fix WP Redirect Loop
  77. Redirect CPT to child?
  78. Add action “page_template” not work with home page
  79. Does wp_redirect keep the referrer?
  80. wp_redirect only works for external pages
  81. wp_redirect shows header already sent message
  82. Too may redirects when i use the wp_redirect() function
  83. Redirect missing pagination to base page
  84. How is WordPress redirecting/rewriting my URL?
  85. Is this consindered safe redirect?
  86. subpages are redirecting to the homepage
  87. Login form- no feedback
  88. Does wp_safe_redirect() no longer works?
  89. Cannot find redirect – WordPress behind HTTPS proxy (Cloudfront)
  90. Cannot Modify Header Information on Shortcode redirect
  91. Redirect not logged in users but exclude 1 page
  92. Create a page and redirect to it after
  93. Redirect after registration and auto login is not working
  94. How can I have customers log in using ONLY customer number? No password
  95. WordPress – Security Question at Login from User’s Meta Data
  96. wp_login_form display no styled form
  97. Running WordPress multisite login from a subdomain
  98. Spam Registrations Bypassing WordPress Registration
  99. Unable to login or reset password via wp-admin
  100. How to force login on wordpress error
Categories wp-redirect Tags wp-login-form, wp-redirect
How to detect if is_404() or is_page() or etc…? [closed]
I restricted wordpress by logged users. It’s possible exclude a page?

Recommended Hostings

Cloudways: Realize Your Website's Potential With Flexible & Affordable Hosting. 24/7/365 Support, Managed Security, Automated Backups, and 24/7 Real-time Monitoring.

FastComet: Fast SSD Hosting, Free Migration, Hack-Free Security, 24/7 Super Fast Support, 45 Day Money Back Guarantee.

Recent Added Topics

  • Bug in translation system: load_theme_textdomain() returns true, files are available and accessible but the language defaults to english
  • Custom Elementor controls not appearing in the widget Advanced tab using injection hooks
  • Get the name of the template/*html file used
  • Trying to Add Paging to Single Post Page
  • Sharing media files between live and staging servers
  • How to display the description of a custom post type in the dashboard?
  • Critical error on image display
  • Copying WP data and files into new install?
  • How to determine the DirectAdmin WordPress backup date?
  • How to get list of ALL tables in the database?
© 2026 Read For Learn
  • Database
    • Oracle
    • SQL
  • algorithm
  • asp.net
  • assembly
  • binary
  • c#
  • Git
  • hex
  • HTML
  • iOS
  • language angnostic
  • math
  • matlab
  • Tips & Trick
  • Tools
  • windows
  • C
  • C++
  • Java
  • javascript
  • Python
  • R
  • Java Script
  • jQuery
  • PHP
  • WordPress