Shortcodes

[wpdm_logout_url] – Logout URL Generator

2 min read Updated Jan 26, 2026

Generate a secure logout URL that can be used anywhere on your site. Perfect for custom navigation menus, buttons, or inline links.

Basic Syntax

[wpdm_logout_url]

Parameters

ParameterTypeDefaultDescription
rstringhome URLURL to redirect users after logging out.

Usage Examples

Basic Logout Link

<a href="[wpdm_logout_url]">Logout</a>

Styled Logout Button

<a href="[wpdm_logout_url]" class="btn btn-danger">
    Sign Out
</a>

Redirect to Custom Page

Send users to a specific page after logout:

<a href="[wpdm_logout_url r='/goodbye/']">Logout</a>

Redirect to Login Page

<a href="[wpdm_logout_url r='/login/']" class="btn btn-secondary">
    Sign Out
</a>

With Icon

<a href="[wpdm_logout_url]" class="btn btn-outline-secondary">
    <i class="fas fa-sign-out-alt"></i> Logout
</a>

Use Cases

  • Navigation Menus – Add logout links to header/footer menus
  • User Dashboard – Include logout option in member areas
  • Sidebar Widgets – Display logout button for logged-in users
  • Custom Templates – Add to page templates with conditional logic

PHP Usage

For theme developers:

<?php if (is_user_logged_in()): ?>
    <a href="<?php echo do_shortcode('[wpdm_logout_url r="/login/"]'); ?>">
        Logout
    </a>
<?php endif; ?>

Tips

  • The shortcode outputs only the URL, not a complete link
  • Wrap in <a> tags and style as needed
  • Use with conditional widgets to show only for logged-in users
  • The logout URL includes a security nonce automatically

Related