Redirection Not Working

Version: 1.2.1 Last Updated: December 2025 Difficulty: Beginner Time Required: 15 minutes

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


<ul>
<li>User logs in successfully</li></ul>

<ul>
<li>Stays on login page instead of redirecting</li></ul>

<ul>
<li>Or redirects to default wp-admin</li></ul>

Solution 1: Configure Login Redirect

Set default redirect URL:
  • Go to Users → Login Settings
  • Find “Login Redirect” section
  • Enter destination URL: /dashboard/
  • Save changes
  • 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:
  • Go to Users → All Users
  • Hover over user, click Edit
  • Check “Role” dropdown
  • 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:
  • Users → Login Settings
  • Find “Force Login” setting
  • Uncheck “Require users to login”
  • Save and test
  • 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:
  • Clear browser cookies for your domain
  • Close all browser tabs
  • Open new incognito window
  • 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:

Logout 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

Disable redirects for REST API:

add_filter(‘attrua_disable_redirect_for_rest’, ‘__return_true’);

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.