← Back to Docs
  • Tags
    • 404
    • asset
    • assets
    • cache
    • collection
    • collection:count
    • collection:next
    • collection:previous
    • dump
    • entries
    • entries:listing
    • env
    • foreach
    • form
    • form:create
    • form:errors
    • form:set
    • form:submission
    • form:submissions
    • form:success
    • get_content
    • get_files
    • get_value
    • glide
    • glide:batch
    • glide:generate
    • increment
    • iterate
    • link
    • locales
    • markdown
    • markdown:indent
    • nav
    • nav:breadcrumbs
    • nav:count
    • nav:exists
    • oauth
    • obfuscate
    • pages
    • pages:listing
    • pages:next
    • pages:previous
    • parent
    • partial
    • path
    • redirect
    • relate
    • routes
    • search
    • search:form
    • section
    • session
    • session:dump
    • session:flash
    • session:flush
    • session:forget
    • session:set
    • switch
    • taxonomy
    • taxonomy:listing
    • theme
    • theme:asset
    • theme:css
    • theme:img
    • theme:js
    • theme:output
    • theme:partial
    • trans
    • trans_choice
    • user
    • user:can
    • user:forgot_password_form
    • user:in
    • user:is
    • user:login_form
    • user:logout
    • user:logout_url
    • user:not_in
    • user:profile
    • user:register_form
    • user:reset_password_form
    • users
    • widont
    • yield
  • Why Statamic?
  • Pricing
  • Docs
  • Marketplace
  • Forum
  • Try for Free
← Back to Docs
  • Tags
    • 404
    • asset
    • assets
    • cache
    • collection
    • collection:count
    • collection:next
    • collection:previous
    • dump
    • entries
    • entries:listing
    • env
    • foreach
    • form
    • form:create
    • form:errors
    • form:set
    • form:submission
    • form:submissions
    • form:success
    • get_content
    • get_files
    • get_value
    • glide
    • glide:batch
    • glide:generate
    • increment
    • iterate
    • link
    • locales
    • markdown
    • markdown:indent
    • nav
    • nav:breadcrumbs
    • nav:count
    • nav:exists
    • oauth
    • obfuscate
    • pages
    • pages:listing
    • pages:next
    • pages:previous
    • parent
    • partial
    • path
    • redirect
    • relate
    • routes
    • search
    • search:form
    • section
    • session
    • session:dump
    • session:flash
    • session:flush
    • session:forget
    • session:set
    • switch
    • taxonomy
    • taxonomy:listing
    • theme
    • theme:asset
    • theme:css
    • theme:img
    • theme:js
    • theme:output
    • theme:partial
    • trans
    • trans_choice
    • user
    • user:can
    • user:forgot_password_form
    • user:in
    • user:is
    • user:login_form
    • user:logout
    • user:logout_url
    • user:not_in
    • user:profile
    • user:register_form
    • user:reset_password_form
    • users
    • widont
    • yield

Logout

Log a user out immediately and redirect them elsewhere.


Example

{{ if should_logout_for_whatever_reason }}
  {{ user:logout redirect="/somewhere" }}
{{ /if }}

This will immediately log a user out and redirect to /somewhere if the condition is met.

If you’d like to just output a link, use the user:logout_url tag.


Parameters

redirect

string

Where the user should be redirected after logging out. Defaults to the home page.

Last modified on September 11, 2016
Improve Content
Table of Contents
  1. Example
  2. Parameters

Statamic

  • Blog
  • Pricing
  • Changelog
  • Legacy v1

Developers

  • Documentation
  • Marketplace
  • Community
  • Discord Chat
  • Forum
  • Screencasts

Company

  • About
  • Partners
  • Testimonials
  • Contact

Resources

  • Showcase
  • Support
  • Privacy
  • Terms
  • License

Join the Newsletter

We send a monthly email with announcements, tips, news, popular addons, and other important info.

©Statamic 2025 Built by the team at Wilderborn since 2012.