WordPress Login / Logout Link in Template

The standard WordPress Login/Logout links often suffice but when you are building custom pages then the default WordPress pages can look a little out of place on your site and therefore you may need to redirect your users to different pages and/or change the text links of those standard links (boy, I’m saying standard a lot in this post!)

WordPress login/logout link

This link directs you to the standard WordPress Login page i.e. yoursite.com/wp-login.php and features the words “Log in” and “Log out” as the hyperlinks. This will send the user to the default login page and once logged in will redirect them to the WordPress Dashboard.

WordPress Login/Logout page with custom links

This will send the user to the default login page and once logged in will redirect them back to the page they were previously on. This will send the user to the default login page and once logged in will redirect them to the WordPress Dashboard.

WordPress Login/Logout page with custom links and redirect to previous page.

This will send the user to the default login page and once logged in will redirect them back to the page they were previously on.

Custom WordPress Login/Logout pages with custom links

The following code will send the user to the page with ID of 22 to login (obviously you will need to add a login form to that page) and then will send them back to the home page when logged out.

11 Responses to WordPress Login / Logout Link in Template

  1. Vijay Kumar says:

    it’s working code. thanks a millions 🙂

  2. Bahme1960 says:

    The log in log out link helps for the movement process. The data might be saved in proper form specified requirement should be meet for the complete action. The system work done in style and require manner.

  3. Baces says:

    The log in log out link helps for the movement process. The data might be saved in proper form specified requirement should be meet for the complete action. The system work done in style and require manner.

  4. tom says:

    Its not good code. After logged out its redirect to 1st post. when ur on homepage.

  5. brilliant .

    it’s working 🙂
    I think i should use it in my new plugin .
    Thanks

  6. Perce says:

    CUSTOM WORDPRESS LOGIN/LOGOUT PAGES WITH CUSTOM LINKS
    Been looking how to do that for ages today ! Many thanks for the info…

Leave a Reply

Your email address will not be published. Required fields are marked *