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

WordPress ReAuth =1 Loop with wpCAS

I got it! Within the wpcas.php file inside of the wpCAS plugin folder, lines 85-123 detail the actual login function of wpCAS. Lines 104 & 108 detail specifically on how wpCAS redirects you to the admin page:

104:

wp_redirect( preg_match( '/^http/', $_GET['redirect_to'] ) ? $_GET['redirect_to'] : site_url( $_GET['redirect_to'] ));

108:

wp_redirect( site_url( '/wp-admin/' ));

However, this results (for reasons unknown to me) in a redirect loop of DOOM. Thanks to this tip, however (many thanks to Mr. Luigi Balzano), I found a solution. Change the wp_redirect functions on these two lines to wp_safe_redirect, like so:

104:

wp_safe_redirect( preg_match( '/^http/', $_GET['redirect_to'] ) ? $_GET['redirect_to'] : site_url( $_GET['redirect_to'] ));

108:

wp_safe_redirect( site_url( '/wp-admin/' ));

This kicked me out of the redirect loop of DOOM.

The plugin, despite being two years old, still works beautifully with WordPress version 3.5.1 and below.

Hope this helps you wpCAS vagrants!

Related Posts:

  1. Use WordPress with a custom OAuth2 provider
  2. wp_authenticate but not logged in
  3. How to save generated JWT token to cookies on login?
  4. Possibility to login without password
  5. Why does WordPress use cookies for /wp-admin and /wp-content/plugins for non-admin users [duplicate]
  6. Advice on setting up private site
  7. Change All Login/Signup Links in Plugin
  8. Login with OpenID, similar to Stack Exchange sites?
  9. How can I make an Ajax login form work with FORCE_SSL_ADMIN enabled?
  10. How can I log a user out of WordPress before the page loads?
  11. Change success message in plugin Theme my login
  12. How to get Login Error messages on a custom template
  13. How to authenticate custom API endpoint in WooCommerce [closed]
  14. How to assign user a role if none is present when logging in
  15. How can a Firebase user registration and login be integrated into a WordPress site?
  16. How do you import members from another system to WordPress and update passwords so they’ll work?
  17. How to get user-meta from Social Login registered users?
  18. Auto login using Active Directory and Windows Authentication
  19. Security error WP 4.0 + WP phpBB Bridge [closed]
  20. Which hook should be used to validate custom form fields on the login form?
  21. How can I make content disappear when a user logs in?
  22. How to create custom LOGIN and REGISTRATION forms?
  23. Tracking last login and last visit
  24. login to wordpress with Get variables instead of Post
  25. Prevent Brute Force Attack
  26. Login with email (WP Modal Login)
  27. Check if the front end user is log in or not
  28. Change wp-login to custom URL login page
  29. Login problem after installing my written plugin [closed]
  30. Too many login attempts
  31. Get ‘Headers already sent’ error for the plugin I am creating when I try to login
  32. Custom Login Page — wp_signon Headers Already Sent?
  33. What am is missing? (API CORS)
  34. Theme My Login Shortcode Doesn’t Return Anything
  35. how do i change my website facebook login button to another text immediately user login? [closed]
  36. WordPress unable to write files in the server
  37. Custom PHP Page Using WordPress login
  38. How to Use the Filter “sidebar_login_widget_form_args”
  39. Manage PDF downloads and protected pages
  40. Cannot access empty property error in Advanced Access Manager
  41. If I use an alternative login (e.g. CAS or other SSO) plugin, is my site protected from the recent brute force login attempts?
  42. login in wordpress using gmail account
  43. How can I replace content on site generated from plugin without changing plugin
  44. Janrain/Simple Modal under Redirected Domain
  45. Linking form to user meta fields
  46. WordPress Multisite Profile Picture Sync Error with Nextend Social Login Plugin
  47. Plugin or ways to limit number of users logging in the website,
  48. force logged in user to stay in the dashboard
  49. How to store a secret for a plugin inside public_html
  50. create pages automatically and dynamically in wordPress
  51. Share login credential with QR code
  52. Which membership plugin for a simple sign in? Personal areas for customers
  53. Discern a specific plugin’s action hooks
  54. prevent anonymous access to WordPress site (non-admin site)
  55. Login/password protected “client page”
  56. WordPress Admin login redirect to homepage
  57. How can I upload and password protect Javadocs in WordPress?
  58. https rewrite not working for All in one security Brute force > rename login url
  59. On button click, redirect users to registration page instead of another page
  60. How can I show login popup when user clicks on download button
  61. When the user entered an unauthorized url redirect to login page
  62. How to show private pages based on a user’s role?
  63. using wordpress login details for other website / application / forum?
  64. wp_signon returns user, in popup window, but the user is not logged in
  65. How to Create Custom Dashboard for my Laundry Website?
  66. wp_login_form() ignoring login_form action hook
  67. User content database [closed]
  68. Auto-login from backend
  69. AJAX login without a plugin does not work. when add a action to function.php
  70. Plugins effecting layout & login
  71. Redirect default login page to a custom page [duplicate]
  72. wp-admin will not redirect to wp-login.php
  73. Adding google authenticator and use only email address of user
  74. Adding a Filter to Sidbar Login Plugin to Change Login Button Lable
  75. First argument is expected to be a valid callback for cp_admin_init and _canonical_charset
  76. how to protect wordpress website
  77. HTTP Error 403 When Trying to Login
  78. Checking url from plugin [duplicate]
  79. What plugin(s) are best for this User registration task? [closed]
  80. Trouble Removing Plugin [closed]
  81. How do I to override login redirect on specific pages?
  82. plugin for different writers [closed]
  83. How to resolve these findings from security audit
  84. ERROR: Cookies are blocked due to unexpected output – no access to FTP
  85. How to Find WordPress site has backdoor login Codes
  86. How to create a custom wordpress plugin for a specific functionality?
  87. Social login authentication via wordpress rest api
  88. WordPress Homepage Login
  89. I cannot login after installing the wp-login timeout setting plugin
  90. WordPress User Registration/ Sign Up -> Able to take Paid Certification Courses & keep track of Completed Certificates
  91. Issue: Unable to Access WordPress Admin and Database Errors
  92. I am trying to add form using ACF plugin and acf_form() function, but my user fields dont show up properly
  93. WP Crowdfunding login redirect fails
  94. Custom Login and Password Reset for BuddyPress Website
  95. Is there a plugin or resource for custom implementation for OAUTH and regular user login?
  96. How to create WordPress login for different users, with different roles?
  97. WP Rest-API response is unauthorized (React)
  98. Content being rendered as empty string in posts endpoint
  99. Lost Password of my site, how to reset wordpress password?
  100. How to customize WP_Error (REST JWT authentication plugin) [closed]
Categories plugins Tags authentication, login, plugins
Custom role, capabilities, and post type: preview button wrecks things
Which hooks are essential for post templates?

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
  • Post Navigation Elementor
  • Custom Elementor controls not appearing in the widget Advanced tab using injection hooks
  • WPFacet multiple loop displaying duplicate content
  • Get the name of the template/*html file used
  • Fix: WordPress.DB.PreparedSQL.NotPrepared Plugin Check (PCP)
  • Removing unnecessary CSS and JS code from wp_head()
  • hexagonal image gallery. Am I on the right track? [closed]
  • Trying to Add Paging to Single Post Page
  • Sharing media files between live and staging servers
© 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