Redirection Not Working

Fix login, logout, and role-based redirection issues.

  • Beginner
  • 15 min read
  • Applies to 1.2.1
  • Updated December 2025

Written for 1.2.1. It is being checked against 2.0, so a screen or a setting may sit somewhere else. Tell support if something does not match.

Overview

Users not redirecting to the correct page after login/logout is one of the most common configuration issues. This guide covers all redirection problems and their solutions.


Issue 1: No Redirection After Login

Symptoms

- User logs in successfully
- Stays on login page instead of redirecting
- Or redirects to default wp-admin

Solution 1: Configure Login Redirect

Set default redirect URL:

1. Go to Users → Login Settings
2. Find "Login Redirect" section
3. Enter destination URL: /dashboard/
4. Save changes
5. Clear cache

Important URL format:

Correct:
/dashboard/          ← Relative URL
/my-account/
https://example.com/members/  ← Absolute URL

Wrong:
dashboard            ← Missing slashes
dashboard/           ← Missing leading slash
www.example.com/dashboard/  ← Missing https://

Solution 2: Use Shortcode Parameter

Override via shortcode:

[attrua_login redirect="/custom-dashboard/"]

This takes priority over settings page configuration.


Solution 3: Check for Redirect Conflicts

Other plugins that may override:

- WooCommerce (redirects to My Account)
- Membership plugins
- Custom login plugins
- Theme functions hooking into login_redirect

Disable temporarily to test:

Deactivate conflicting plugins one by one
Test login redirect
Identify which plugin interferes
Configure that plugin to work with Attributes

Issue 2: Role-Based Redirect Not Working

Symptoms

- All users redirect to same page
- Role-specific redirects ignored
- Some roles work, others don't

Solution 1: Verify Role Configuration

Check role redirect settings:

Users → Login Settings → Role-Based Redirections

Ensure configuration like:
Administrator  → /wp-admin/
Editor         → /content-dashboard/
Author         → /my-posts/
Subscriber     → /member-area/

Default (no match) → /homepage/

Solution 2: Check Role Priority

WordPress uses first matching role:

Problem:
User has roles: [Subscriber, Customer]
Redirect for Subscriber: /blog/
Redirect for Customer: /shop/
User redirects to: /blog/ (first match)

Solution:
Order matters! Configure most specific roles first
Or ensure users only have one primary role

Solution 3: Test Role Assignment

Verify user actually has expected role:

1. Go to Users → All Users
2. Hover over user, click Edit
3. Check "Role" dropdown
4. Verify correct role assigned

Common issues:

- User role changed by another plugin
- WooCommerce assigns "Customer" role, overriding Subscriber
- Membership plugin assigns custom role

Issue 3: Redirect Loop

Symptoms

- Browser shows "Too many redirects"
- ERR_TOO_MANY_REDIRECTS error
- Page keeps reloading indefinitely

Solution 1: Check Circular Redirects

Identify the loop:

Problem Example:
Login redirect → /dashboard/
/dashboard/ requires login → redirects to /login/
/login/ redirects to → /dashboard/
= Infinite loop!

Solution:
Ensure destination page is accessible to logged-in users
Check page doesn't force login redirect back to login page

Solution 2: Disable Force Login

Temporarily disable to test:

1. Users → Login Settings
2. Find "Force Login" setting
3. Uncheck "Require users to login"
4. Save and test
5. If loop stops, configure exclusions properly

Properly configure exclusions:

Force Login Exclusions:
/login/
/wp-login.php
/wp-admin/admin-ajax.php
/register/

Solution 3: Clear Cookies

Browser cookies may cause loops:

1. Clear browser cookies for your domain
2. Close all browser tabs
3. Open new incognito window
4. Test login again

Issue 4: Logout Doesn't Redirect

Symptoms

- Click logout link
- User logged out successfully
- Stays on current page or goes to wp-login.php

Solution: Configure Logout Redirect

Set logout destination:

Users → Login Settings → Redirections

Logout Redirect URL: /homepage/

Or use logout URL parameter:
<a href="/wp-login.php?action=logout&redirect_to=/goodbye/">Logout</a>

Create custom logout page:

Page: /goodbye/

Content:
"You have been logged out successfully.
Thank you for visiting!"

[Login Again Button]

Issue 5: Redirect Works Only Sometimes

Symptoms

- Redirection inconsistent
- Works for some users, not others
- Works on desktop, not mobile

Solution 1: Check Caching

Login pages shouldn't be cached:

Cache plugin configuration:
- Exclude page: /login/
- Exclude page: /dashboard/
- Never cache pages with login forms
- Never cache personalized content

Cloudflare/CDN:

Page Rules:
URL: *example.com/login*
Setting: Cache Level = Bypass

Solution 2: Check User Capabilities

Verify destination page permissions:

Problem:
Subscriber redirected to /admin-panel/
But /admin-panel/ requires Editor role
User can't access, redirects elsewhere

Solution:
Ensure redirect destination matches user capabilities
Use role-appropriate destinations

Issue 6: Mobile App Login Issues

Symptoms

- Website login works
- Mobile app login fails to redirect
- API authentication doesn't redirect properly

Solution: Check REST API Configuration

For mobile/API access:

Don't rely on redirects for API logins
Return JSON success response instead
Let app handle navigation

There is no attrua_disable_redirect_for_rest filter. The redirect guard already skips the admin, AJAX requests and anyone signed in — it does not act on a REST request that carries no session, because there is nothing to redirect.

If a REST route of your own is being redirected, the cause is a forced login rule matching its path, not the login redirect. Exclude the path there, or check attrua_login_redirect, which is the real filter for deciding where a sign-in lands.


Issue 7: WooCommerce Conflicts

Symptoms

- WooCommerce overrides redirects
- Users redirect to My Account instead of custom page
- Checkout redirects not working

Solution: Configure WooCommerce Integration

Priority settings:

Users → Login Settings → WooCommerce Integration

Choose priority:
○ WooCommerce redirects take priority
● Attributes User Access redirects take priority

For most cases: Choose Attributes priority

Specific WooCommerce pages:

My Account login → Use WooCommerce default
All other logins → Use Attributes redirect

Issue 8: External Redirects Blocked

Symptoms

- Can redirect to internal pages (/dashboard/)
- Can't redirect to external URLs (https://example.com)
- Security warning shown

Solution: Whitelist External Domains

Enable external redirects:

// Add to functions.php
add_filter('allowed_redirect_hosts', function($hosts) {
    $hosts[] = 'partner-site.com';
    $hosts[] = 'another-domain.com';
    return $hosts;
});

Security Note: Only whitelist trusted domains. External redirects can be exploited by attackers for phishing.


Testing Redirects

Systematic Testing Process

  • Clear all caches (WordPress, plugin, browser)
  • Open incognito/private browser window
  • Navigate to login page
  • Log in with test account for each role
  • Verify correct destination for each role
  • Test logout redirect
  • Test on mobile device

Debug Redirect Issues

Enable debug logging:

// Add to wp-config.php
define('WP_DEBUG', true);
define('WP_DEBUG_LOG', true);

// Login and check /wp-content/debug.log
// Look for redirect-related messages

URL Validation

Common URL Mistakes

❌ Wrong:
- /dashboard (no trailing slash)
- dashboard/ (no leading slash)
- www.site.com/page (no protocol)
- /page-with-typo/ (page doesn't exist)

✅ Correct:
- /dashboard/
- /member-area/
- https://www.site.com/page/
- /existing-published-page/

Best Practices

Test Each Role Separately
Create test account for each role. Verify redirects work for all.

Use Absolute Paths
Use /page/ format for internal redirects. More reliable than relative paths.

Create Destination Pages First
Publish destination pages before configuring redirects. Broken links cause issues.

Document Your Redirect Logic
Keep notes on which roles go where. Helps troubleshoot later.


Related articles

Something missing or out of date? Tell support.