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

How do I to override login redirect on specific pages?

Answer:

I’ve figured this out myself.

Add the following code to your theme’s functions.php file:

// Plugin by http://wordpress.org/extend/plugins/peters-login-redirect/
// Solution by http://www.dominornovus.com

function login_widget_redirect( $empty, $redirect_to, $requested_redirect_to, $user )
{
// If the referring page contains "/forums/"...
if (stripos($_SERVER['HTTP_REFERER'],'/forums/') !== false)
{
$referringpage = $_SERVER[HTTP_REFERER];
return $referringpage;
}
//Otherwise, check the referring page contains "/blog/"...
else if (stripos($_SERVER['HTTP_REFERER'],'/blog/') !== false)
{
$referringpage = $_SERVER[HTTP_REFERER];
return $referringpage;
}
// Otherwise, default to the plugin's redirect settings...
else
{
return false;
}

}

add_filter( 'rul_before_user', 'login_widget_redirect', 10, 4 );

This will effectively disable the plugin’s redirect settings anytime a user logs in from a forum or blog page. The standard wp-login.php page will inherit the plugin’s redirect settings.

You can find a detailed explanation of the code at my blog:

http://www.dominornovus.com/2011/11/14/restrict-peters-login-redirect-to-same-page-redirection/

Related Posts:

  1. wordpress custom login successful redirect hook
  2. How can I check if on specific plugin generated page or child
  3. How to use login_redirect with a user capability
  4. Janrain/Simple Modal under Redirected Domain
  5. WordPress Admin login redirect to homepage
  6. Redirection plugin – how to let the editor access the ‘redirection’ menu?
  7. How can I make an Ajax login form work with FORCE_SSL_ADMIN enabled?
  8. SSL redirect loop using WordPress HTTPS Plugin
  9. Redirection Plugin: Redirect all URLs with a regular expression
  10. How can I pass a variable to wp_ajax action?
  11. How to get user-meta from Social Login registered users?
  12. Which hook should be used to validate custom form fields on the login form?
  13. flush_rewrite_rules not working on plugin deactivation, invalid URLs not showing 404
  14. Tracking last login and last visit
  15. Detecting $_GET parameters from any page + Cookie
  16. How to send “Location” header on plugin form submit event?
  17. Prevent Brute Force Attack
  18. Login with email (WP Modal Login)
  19. Check if the front end user is log in or not
  20. How to create a word press user with hashedpassword
  21. Is there any good tutorial to write custom login, registration and password recovery forms? [closed]
  22. How to redirect Old Post URL to new Post and keep Old post Comments?
  23. What’s the _wp_desired_post_slug value for?
  24. WordPress login with Phone Number [closed]
  25. Cannot access wp-admin after disabling all plugin
  26. wp_authenticate but not logged in
  27. how can I link to a PlugIn admin-sub-menu page after processing a formular
  28. How does automatic redirection for the redirection plugin work?
  29. How do i login when i cant access wp-login.php?
  30. Changed permalink structure. Need help with redirecting old posts
  31. Landing Page Redirect Chain | http->https->https www
  32. Single central login for front end users from any site
  33. Redirection based on location but without affecting search bots
  34. how to create site exit messages with destination url displayed
  35. Plugin: Google Analytics for Dashboard error – Timestamp is too far from current time
  36. “Request has expired” with “Make your site social” (Gigya) plugin
  37. WordPress Shortcode to get URL Parameters $_GET[‘name’] redirects for no reason at all
  38. How to fix the woocommerce – adaranth.com redirection issue [closed]
  39. WordPress change Language not working
  40. Redirecting thousands of posts that currently have no category in their permalink when changing permalink structure to include category
  41. easy steps to make front end form without plugin
  42. Removing Automatic Redirects Without Plugin
  43. Change wp-login to custom URL login page
  44. Duplicate New User Registration notices (BuddyPress and bbPress both installed)
  45. Edit Permalink Structure For Custom Post Type or Modify .htaccess?
  46. Too many login attempts
  47. Get ‘Headers already sent’ error for the plugin I am creating when I try to login
  48. Custom Login Page — wp_signon Headers Already Sent?
  49. How can I redirect some pages to new subdomain? [closed]
  50. Theme My Login Shortcode Doesn’t Return Anything
  51. Possibility to login without password
  52. Conditional custom redirect
  53. how to set parent forum link to menu page?
  54. How do I determine if the user who registered is not spam?
  55. PHP mobile redirect Endless loop
  56. login in wordpress using gmail account
  57. wp redirect 301 not working in wordpress page
  58. Preserve Search engine index while shifting to new Domain
  59. WordPress Multisite Profile Picture Sync Error with Nextend Social Login Plugin
  60. Redirect unloggedin users
  61. Plugin or ways to limit number of users logging in the website,
  62. Identify User Language, Redirect to the corresponding page and Save the chosen language as Cookie
  63. Display value of the GET parameter in a new URL page
  64. Which membership plugin for a simple sign in? Personal areas for customers
  65. Can’t add new plugin or themes on a wordpress multisite network from the primary site as administrator. Error: ERR_TOO_MANY_REDIRECTS
  66. Login/password protected “client page”
  67. Reverse count page view and show on other page
  68. On button click, redirect users to registration page instead of another page
  69. How can I show login popup when user clicks on download button
  70. Why does WordPress use cookies for /wp-admin and /wp-content/plugins for non-admin users [duplicate]
  71. Identify if the_post hook is being called from the admin post list
  72. Infinite 301 redirects after definitions in “Redirections” plugin?
  73. Clone a Post Tite and Custom Field into Custom Post type
  74. Direct URL to a template via plugin
  75. Auto-login from backend
  76. Plugins effecting layout & login
  77. wp-admin will not redirect to wp-login.php
  78. Adding google authenticator and use only email address of user
  79. Adding a Filter to Sidbar Login Plugin to Change Login Button Lable
  80. how to protect wordpress website
  81. Redirect url in plugin to somewhere else?
  82. WordPress ReAuth =1 Loop with wpCAS
  83. HTTP Error 403 When Trying to Login
  84. Advice on setting up private site
  85. phpBB 3 to bbPress
  86. What plugin(s) are best for this User registration task? [closed]
  87. Trouble Removing Plugin [closed]
  88. plugin for different writers [closed]
  89. How to resolve these findings from security audit
  90. ERROR: Cookies are blocked due to unexpected output – no access to FTP
  91. URL Redirect on GoDaddy platform [closed]
  92. How to create a custom wordpress plugin for a specific functionality?
  93. Redirecting to page on form submit – Revue plugin
  94. Remove embed url for internal links
  95. Page with redirect
  96. How to create a buddypress group automatically if a topic is created
  97. BBPress Customization with Custom Plugin
  98. Show different page depending on user role
  99. add to cart linking to add to cart page
  100. Custom Login and Password Reset for BuddyPress Website
Categories plugins Tags bbpress, login, plugins, redirect
Single page template
Calling Custom Post Meta

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