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
| Parameter | Type | Default | Description |
|---|---|---|---|
r | string | home URL | URL 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
- [wpdm_login_form] – Login form display
- [wpdm_user_dashboard] – User dashboard area