How to create a clickable icon log in/log out link in WordPress

You are currently viewing How to create a clickable icon log in/log out link in WordPress

If you would like to have a clickable padlock icon link in WordPress that allows you to log in or log out, follow these easy steps:

1. In WordPress, go to Appearance > Theme Editor.

2. On the right, select functions.php.

3. Scroll to the bottom of the page and copy and then paste the following lines of code:

4. At the bottom-left of the screen, press Update File.

Copy and then paste the following shortcode where you want the link to appear:

Where ever you placed the above shortcode, a padlock icon will appear. If you are logged in, the padlock icon will appear unlocked.

Clicking the unlocked padlock icon will log you out. Once you are logged out, the padlock icon will appear locked.

Clicking the locked padlock icon will take you to the login page.

I recommend placing the shortcode on the footer, but you do you.

Rick Rottman

My name is Rick Rottman, and this is my personal website. I was born and raised in Southern California, but I've lived most of my adult life in Maryland. I'm an U.S. Air Force veteran. I collect a plethora of frivolous things. I'm a WordPress enthusiast.

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.