Login Form Shortcode Reference

Version: 1.2.1 (Core) Last Updated: November 2025 Difficulty: Intermediate Time Required: 15 minutes

Overview

The

shortcode is the foundation of Attributes User Access, allowing you to embed fully functional login forms anywhere on your WordPress site. This comprehensive reference covers every parameter and option available.

Basic Usage

Minimal Shortcode



This displays a complete login form with default settings:

  • Username/email field
  • Password field
  • Remember me checkbox
  • Submit button
  • Lost password link

Complete Parameter Reference

Redirect Parameters

redirect

Purpose: Where users go after successful login Type: String (URL) Default: WordPress dashboard Example:
Accepts:
  • Relative URLs: /member-area/
  • Absolute URLs: https://yoursite.com/dashboard/
  • Page slugs: Will auto-resolve to full URL

redirect_on_logout

Purpose: Where users go after logging out Type: String (URL) Default: Current page Example:
Common Values:
  • / - Homepage
  • /login/ - Login page
  • /goodbye/ - Thank you page

Form Identification

form_id

Purpose: Custom HTML ID for the form element Type: String Default: attributes_login_form <strong>Example:</strong> <p>
</p> <strong>Use Cases:</strong> <ul> <li>Multiple forms on same page</li></ul> <ul> <li>Custom CSS targeting</li></ul> <ul> <li>JavaScript form manipulation</li></ul> <ul> <li>Analytics tracking</li></ul> <div class="attrua-warning-box"><strong>Important:</strong> Each form_id must be unique on the page. Duplicate IDs will cause HTML validation errors. </div> <h3>Label Customization</h3> <h4></h4>
label_username<strong>Purpose:</strong> Label text for username/email field <strong>Type:</strong> String <strong>Default:</strong> "Username or Email" <strong>Example:</strong> <p>
</p> <strong>Popular Alternatives:</strong> <ul> <li>"Email"</li></ul> <ul> <li>"Username"</li></ul> <ul> <li>"Email or Username"</li></ul> <ul> <li>"Student ID"</li></ul> <ul> <li>"Member ID"</li></ul> <h4></h4>
label_password<strong>Purpose:</strong> Label text for password field <strong>Type:</strong> String <strong>Default:</strong> "Password" <strong>Example:</strong> <p>
</p> <strong>Alternatives:</strong> <ul> <li>"Enter Password"</li></ul> <ul> <li>"Account Password"</li></ul> <ul> <li>"Secure Password"</li></ul> <h4></h4>
label_remember<strong>Purpose:</strong> Label text for remember me checkbox <strong>Type:</strong> String <strong>Default:</strong> "Remember Me" <strong>Example:</strong> <p>
</p> <strong>Popular Alternatives:</strong> <ul> <li>"Remember me on this device"</li></ul> <ul> <li>"Stay logged in"</li></ul> <ul> <li>"Keep me signed in"</li></ul> <ul> <li>"Remember on this computer"</li></ul> <h4></h4>
label_submit<strong>Purpose:</strong> Text for submit button <strong>Type:</strong> String <strong>Default:</strong> "Log In" <strong>Example:</strong> <p>
</p> <strong>Creative Alternatives:</strong> <ul> <li>"Access Account"</li></ul> <ul> <li>"Enter"</li></ul> <ul> <li>"Sign In Now"</li></ul> <ul> <li>"Access Members Area"</li></ul> <ul> <li>"Continue"</li></ul> <h4></h4>
label_lost_password<strong>Purpose:</strong> Link text for password reset <strong>Type:</strong> String <strong>Default:</strong> "Lost your password?" <strong>Example:</strong> <p>
</p> <strong>Alternatives:</strong> <ul> <li>"Reset Password"</li></ul> <ul> <li>"Can't access your account?"</li></ul> <ul> <li>"Forgot your password?"</li></ul> <ul> <li>"Need help signing in?"</li></ul> <h3>Behavior Parameters</h3> <h4></h4>
value_remember<strong>Purpose:</strong> Default state of remember me checkbox <strong>Type:</strong> Boolean (true/false) <strong>Default:</strong> false <strong>Example:</strong> <p>
</p> <strong>Values:</strong> <ul> <li></ul>
true - Checkbox is checked by default <ul> <li></ul>false - Checkbox is unchecked by default <div class="attrua-pro-tip"><strong>💡 Security Tip:</strong> Set to false for public computers or high-security sites. Set to true for member sites where users typically use personal devices. </div> <h2>Complete Examples</h2> <h3>Example 1: Simple Member Login</h3> <p>
</p> <strong>Use Case:</strong> Membership website with exclusive content area <strong>Features:</strong> <ul> <li>Redirects to member dashboard after login</li></ul> <ul> <li>Custom button text for clarity</li></ul> <h3>Example 2: E-Commerce Customer Login</h3> <p>
</p> <strong>Use Case:</strong> WooCommerce store or online shop <strong>Features:</strong> <ul> <li>Customer-friendly labels</li></ul> <ul> <li>Redirects to account page</li></ul> <ul> <li>Returns to shop after logout</li></ul> <h3>Example 3: Corporate Intranet</h3> <p>
</p> <strong>Use Case:</strong> Employee portal with enhanced security <strong>Features:</strong> <ul> <li>Security-focused (no remember me)</li></ul> <ul> <li>Professional labeling</li></ul> <ul> <li>Returns to login after logout</li></ul> <h3>Example 4: Educational Platform</h3> <p>
</p> <strong>Use Case:</strong> Online learning platform for students <strong>Features:</strong> <ul> <li>Student-specific terminology</li></ul> <ul> <li>Clear instructions</li></ul> <ul> <li>Device-specific remember me text</li></ul> <h3>Example 5: Client Portal</h3> <p>
</p> <strong>Use Case:</strong> Professional services client area <strong>Features:</strong> <ul> <li>Client-focused language</li></ul> <ul> <li>Descriptive labels</li></ul> <ul> <li>Professional branding</li></ul> <h2>Using Shortcodes in Different Contexts</h2> <h3>In Pages and Posts</h3> <strong>Standard Usage:</strong> <ul> <li>Edit page or post</li></ul> <ul> <li>Add shortcode block (Block Editor) or paste directly (Classic Editor)</li></ul> <ul> <li>Enter shortcode with desired parameters</li></ul> <ul> <li>Publish or update</li></ul> <h3>In Widgets</h3> <strong>Widget Area Implementation:</strong> <ul> <li>Go to </li></ul>
Appearance > Widgets <ul> <li>Add "Shortcode" or "Custom HTML" widget</li></ul> <ul> <li>Paste shortcode:</li></ul> <p>
</p> <strong>Recommended for:</strong> Sidebars, footers, header areas <h3>In Theme Templates</h3> <strong>PHP Method:</strong> <pre><code class="language-php"> <?php if (shortcode_exists('attributes_login_form')) { echo do_shortcode('
'); } ?>
With Wrapper:

<?php if (shortcode_exists('attributes_login_form')) {
    echo '<div class="my-custom-login-wrapper">';
    echo do_shortcode('
'); echo '
‘; } ?>

Conditional Display

Show Only to Logged-Out Users:

<?php if (!is_user_logged_in() && shortcode_exists('attributes_login_form')) {
    echo do_shortcode('
'); } else if (is_user_logged_in()) { echo 'You are already logged in. <a href="' . wp_logout_url() . '">Logout'; } ?>

Parameter Combination Best Practices

Keep It Simple

✅ Good:

❌ Too Complex:

Recommendation: Only customize parameters you actually need.

Prioritize User Experience

Essential Parameters:
  • redirect - Where users go after login
  • label_submit - Clear call-to-action
Optional Parameters:
  • Only customize labels if defaults don’t fit
  • Only change form_id if you have multiple forms
  • Only set value_remember if security requires it

Test All Combinations

After adding parameters, always test:

    • Form displays correctly
    • Labels are clear and readable
    • Redirects work as expected
    • Mobile view is functional
    • No JavaScript errors in console

Common Mistakes to Avoid

Mistake 1: Typos in Parameters

Wrong:

Correct:

Error Result: Parameter is ignored, default behavior applies

Mistake 2: Invalid URLs

Wrong:

Correct:

Always include leading slash for relative URLs!

Mistake 3: Duplicate Form IDs

Wrong (on same page):

Correct:

Mistake 4: Quotes Within Quotes

Wrong:

Correct:

Or use HTML entities:

Debugging Shortcode Issues

Shortcode Appears as Text

Symptoms: You see
on the page <strong>Causes:</strong> <ul> <li>Plugin not activated</li></ul> <ul> <li>Shortcode in wrong context</li></ul> <ul> <li>Syntax error in shortcode</li></ul> <strong>Solutions:</strong> <ul> <li>Verify plugin is activated</li></ul> <ul> <li>Check for typos in shortcode name</li></ul> <ul> <li>Ensure shortcode is in a block that supports shortcodes</li></ul> <h3>Parameters Not Working</h3> <strong>Symptoms:</strong> Changes to parameters have no effect <strong>Debug Steps:</strong> <ul> <li><strong>Check syntax:</strong> Ensure proper spacing and quotes</li></ul> <ul> <li><strong>Clear cache:</strong> Browser cache and WordPress cache</li></ul> <ul> <li><strong>Test default:</strong> Try </li></ul>
` without parameters
  • Browser console: Check for JavaScript errors (F12)

Form Doesn’t Display

Symptoms: Blank space where form should be Causes:
  • JavaScript error
  • CSS hiding form
  • Plugin conflict
Solutions:
  • Check console: Look for JavaScript errors
  • Inspect element: Look for hidden CSS
  • Test theme: Switch to default WordPress theme
  • Disable plugins: Test for conflicts