Title: Logout shortcode in header
Last modified: August 31, 2016

---

# Logout shortcode in header

 *  Resolved [alexmattorr](https://wordpress.org/support/users/alexmattorr/)
 * (@alexmattorr)
 * [10 years, 3 months ago](https://wordpress.org/support/topic/logout-shortcode-in-header/)
 * Logout shortcode in header doesn’t update to _logout_ and only says _You have
   been successfully logged out._. I read somewhere else that this has to be done
   on the page the user is redirected to, and I have done this but again it still
   doesn’t change.
 * [https://wordpress.org/plugins/front-end-only-users/](https://wordpress.org/plugins/front-end-only-users/)

Viewing 5 replies - 1 through 5 (of 5 total)

 *  Plugin Contributor [etoilewebdesign](https://wordpress.org/support/users/etoilewebdesign/)
 * (@etoilewebdesign)
 * [10 years, 3 months ago](https://wordpress.org/support/topic/logout-shortcode-in-header/#post-7104084)
 * Hi Alex,
 * Could you please describe in further detail what you are trying to do and what
   is actually happening?
 * For example, are you trying to add a logout link to your menu that redirects 
   users somewhere else once they are logged out?
 * Along with a detailed explanation, a link to your site would likely help us see
   what’s going on.
 * Thank you
 *  Thread Starter [alexmattorr](https://wordpress.org/support/users/alexmattorr/)
 * (@alexmattorr)
 * [10 years, 3 months ago](https://wordpress.org/support/topic/logout-shortcode-in-header/#post-7104118)
 * I have the logout shortcode in my header.php. Even if no user has logged in, 
   I get the _You have been successfully logged out._.
 * I read on another thread that the logout code should only be in the area where
   the user is redirected / has access. So I removed the **<?php echo do_shortcode(“[
   logout]”); ?>** from the header.php and moved it to the specific page that the
   user gets redirected to after they login. Even in this specific page, I still
   get the _You have been successfully logged out._.
 * All I am trying to do is:
 * **If the user is not logged in**, There is a link in the header where they have
   a link to the sign in page.
 * **If the user is logged in**, There is the sign out link / button in the header.
 *  Plugin Contributor [etoilewebdesign](https://wordpress.org/support/users/etoilewebdesign/)
 * (@etoilewebdesign)
 * [10 years, 3 months ago](https://wordpress.org/support/topic/logout-shortcode-in-header/#post-7104254)
 * Hi Alex,
 * It sounds like your best option to get exactly what you need would be to use 
   the public function we have made available in our plugin. This would allow you
   to display different elements in the same area based on whether or not someone
   is logged in. We have a video explaining this here: [https://www.youtube.com/watch?v=bKiJAjq7PhQ](https://www.youtube.com/watch?v=bKiJAjq7PhQ).
 *  Thread Starter [alexmattorr](https://wordpress.org/support/users/alexmattorr/)
 * (@alexmattorr)
 * [10 years, 3 months ago](https://wordpress.org/support/topic/logout-shortcode-in-header/#post-7104265)
 * Hi Etolie,
 * That worked great and I really appreciate the help.
 * I have one more quick question. So now the boolean is checking and works properly
   now, the only issue is that I am doing: **echo do_shortcode(“[logout]”);** if
   the user is logged in, and it displays the _You have been successfully logged
   out_. Is there anyway I can just force the logout link with a public function?
 *  Plugin Contributor [etoilewebdesign](https://wordpress.org/support/users/etoilewebdesign/)
 * (@etoilewebdesign)
 * [10 years, 3 months ago](https://wordpress.org/support/topic/logout-shortcode-in-header/#post-7104270)
 * Hi Alex,
 * This is happening because the [logout] shortcode is meant to be used on a page.
 * Instead of **echo do_shortcode(“[logout]”);** could you try inserting a link 
   to a page that has the [logout] shortcode on it? For example:
 * `<a href="http://url.of.page.with.shortcode">Log Out</a>`

Viewing 5 replies - 1 through 5 (of 5 total)

The topic ‘Logout shortcode in header’ is closed to new replies.

 * ![](https://ps.w.org/front-end-only-users/assets/icon-128x128.png?rev=1805921)
 * [Front End Users](https://wordpress.org/plugins/front-end-only-users/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/front-end-only-users/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/front-end-only-users/)
 * [Active Topics](https://wordpress.org/support/plugin/front-end-only-users/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/front-end-only-users/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/front-end-only-users/reviews/)

 * 5 replies
 * 2 participants
 * Last reply from: [etoilewebdesign](https://wordpress.org/support/users/etoilewebdesign/)
 * Last activity: [10 years, 3 months ago](https://wordpress.org/support/topic/logout-shortcode-in-header/#post-7104270)
 * Status: resolved