Create A Wordpress Logout Link

Chris Creed / 29th September 2009

Create A Wordpress Logout Link Create A Wordpress Logout Link

Adding a logout button to your Wordpress site can be a nice little timesaver – it saves you having to access your Wordpress admin area and logging out from there. Whilst it doesn’t take much time to logout from the admin area, it can become a little irritating at times (especially if you have multiple sites and/or are developing Wordpress themes).

Adding a logout button can also be useful for sites that have multiple authors – it’s very simple to do and only requires a few lines of code.

Add the following code to the area on your site that you would like the logout link to appear (e.g. you might put it in your footer (footer.php) or at the bottom of your sidebar (sidebar.php)):

<?php if (is_user_logged_in()){
	<a href="<?php echo wp_logout_url(); ?>">Logout</a>
} ?>

This will then add a link to your site that when clicked will log you out!

Enjoy This Post? Please Consider Sharing :-)

  • Twitter
  • StumbleUpon
  • Facebook
  • Digg
  • del.icio.us
  • Reddit
  • Technorati

About The Author

Chris Creed

Hi there, I'm Chris and the Founder of Voosh Themes. I've been designing & developing websites for over 10 years and am interested in just about anything related to design. I also have a PhD in Computer Science (with a particular focus on Interaction Design) - you can follow me on Twitter at @cpcreed.

Leave a Reply