# Showing a logout link into a theme

URL: https://wpusermanager.com/article/167-showing-a-logout-link-into-a-theme/
Last updated: 2019-09-05

Showing a logout url into a theme can be done with the [wp\_logout\_url()](https://codex.wordpress.org/Function_Reference/wp_logout_url) function. This function can be placed anywhere into your theme files and accepts a custom url as optional parameter.

If the redirect parameter is not used, users will automatically be redirected to the page you've selected into the settings panel.

Example usage: logout and redirect to current page.

```
<a href="<?php echo esc_url( wp_logout_url( get_permalink() ) ); ?>">
  <?php _e('Logout', 'wpum'); ?></a>
```

Example usage: logout and redirect to another page by ID

```
<a href="<?php echo esc_url( wp_logout_url( get_permalink( 5 ) ) ); ?>">
  <?php _e('Logout', 'wpum'); ?></a>
```
