Logout shortcode for wordpress


Create a logout shortcode for WordPress. Sometimes of membership WordPress site we don’t show admin bar to use for security issue. And our user wants to log out but they cannot found any log out option for the basic site. 

So that, you can create a simple logout link/button for WordPress. If user logged in only then they can see this text/button. And when they click on the text/button they will be logged out and redirect to the home page or in the same page. Just place this code to your theme function.php file and place the shortcode “[logout]” where you want like in the post, page, widget etc.

Copy & paste the above code to your WordPress theme function.php file located on your “WordPress directory/wp-content/themes/YOUR_RUNNING_THEME/function.php”. Then add/place “[logout]” shortcode anywhere you want. There are many ways to do it but I just got a simple way for me, hope it will help you too.

Leave a Reply