Introductory Pricing: Save 50% on your first year of any plan. Use coupon code:

FIRSTYEAR50

  • Log In
  • Welcome
  • Features
  • Pricing
  • Documentation
  • Case Studies
  • Add Ons
  • Support
  • Learn
  • Events
  • Blog
  • Contact

Log In

Join Now | Lost Password?
Skip to content
Paid Memberships Pro WordPress Membership Plugin
  • Log In
  • Choose a Plan
  • Features
    • PMPro Platform
      • Plugin Features
      • Restrict Access
      • Register Members
      • Subscriptions
      • All Features
    • Payment Gateways
      • Stripe
      • PayPal Express
      • Paystack
      • CCBill
      • All Gateways
    • Add Ons
      • Integrations
      • Free Add Ons
      • Standard Add Ons
      • Plus Add Ons
      • All Add Ons

    Launch a Free Demo
    Explore PMPro in action with your own private demo site—preloaded with members, protected content, and premium Add Ons.

    Try PMPro Now
  • Use Cases
    • Associations
    • Blog and News
    • Communities
    • Courses
    • Directories
    • Paid Newsletters
    • Private Videos
    • Podcasting
  • Documentation
    • Download & Install
      • Download PMPro
      • Install Add Ons
      • Memberlite Theme
      • Setup WordPress
      • Staging Sites
      • Support
    • Initial Setup
      • Customize Pages
      • Payment Settings
      • Restrict Content
      • Membership Levels
      • Member Emails
      • User Fields
    • More Docs
      • Shortcodes & Blocks
      • Design Settings
      • Page Builders
      • Reporting
      • For Developers
      • All Docs

    Get your membership site up and running with Kim's help.

    Watch Initial Setup
  • Community
    • Engage & Learn
      • Upcoming Events
      • Courses
      • Videos
      • Step-by-Step Guides
      • Join Slack
      • Get Support
    • Blog
      • Case Studies
      • Product Comparison
      • Code Recipes
      • Release Notes
      • Migration Guides
      • All Blog Posts

    Join the Community
    Connect with other membership site creators who use PMPro to get paid.

    Join Slack
  • Pricing
Home  >  Blog  >  How to Add a Conditional Log in and Log out Link to Your WordPress Menu

How to Add a Conditional Log in and Log out Link to Your WordPress Menu

Estimated reading time: 2 minutes

TweetFacebookLinkedIn

This post covers a few methods to add a “Log In” and “Log Out” link to all the places where a user would expect to see them on your website. Use one of the options below to add a conditional “Log In” link to a Menu in the WordPress Appearance > Menus admin page.

Member Experience Tip: Conditional Log In and Log Out Menu Links

Table of contents

  • “Log In” and “Log Out” Custom Menu Links
  • Use the Memberlite Theme
  • Custom Code the Menu In Your Theme or via a Custom Filter
    • The function has two parameters:

“Log In” and “Log Out” Custom Menu Links

Paid Memberships Pro adds a new section to the “Menus” administration pages in your WordPress dashboard. This section includes all core pages created by the plugin, as well as links for member login and logout. These unique links can both be placed in any menu location and will be shown/hidden based on the user’s login status.

Customize > Menus > Paid Memberships Pro section
View Menus Documentation

Use the Memberlite Theme

The Memberlite Theme has a built in log in / log out menu area in the upper right area of your WordPress site. You can enable this feature on the Appearance > Customize > Memberlite Options screen in the WordPress admin. Check the option to “Show Login/Member Info in Header”.

If the user is logged in and Paid Memberships Pro is active, the member will see their display name linked to the ‘Membership Account’ page, alternately they will see their display name linked to the ‘Edit Profile’ page.

You can add a members menu to this area under Appearance > Menus screen in the WordPress Admin. Read more about Memberlite menu options here.

Custom Code the Menu In Your Theme or via a Custom Filter

If you’re comfortable with editing your theme, you can add the login/logout link anywhere you would like via this function:

<?php wp_loginout(); ?>

The function has two parameters:

<?php wp_loginout( $redirect, $echo ); ?>
  • $redirect: (optional) URL to redirect to on login/logout.
  • $echo: (optional) If true, echos the link, if false, returns the link as a string. (default: true)

Read more about this function at the WordPress codex, including how to filter a wp_nav_menu to add the conditional link via a custom function.

If you’re on a multisite network, note that these methods may not work 100% as intended. Using the WordPress function in a theme file is the best method for your network/multisite.

Kim Coleman

Author: Kim Coleman

Kim Coleman is the co-founder of Paid Memberships Pro, the most trusted membership platform, which powers over 90,000 membership sites worldwide. With over two decades of experience in development, management, and marketing, Kim plays a pivotal role in shaping the product and guiding the team.

She specializes in content creation, video tutorials, and frontend development for the core open-source plugin and its various Add Ons, helping businesses of all sizes build and grow their membership sites.

View more articles by Kim Coleman »

Cover image from ebook 29 Nuggets of Wisdom Volume 1 - Sample Collection

Download the free ebook: Get 29 insights and ‘aha moments’ for new or veteran membership site business owners. Use these nuggets of wisdom to inspire or challenge you.

Free Download Now


Was this article helpful?
YesNo
Tagged: log out, login link. Posted in General. Bookmark the permalink. Last updated: May 18, 2020.
Post navigation
← Redirect Members to Referrer on Login
How to Bulk Update User Roles to a Custom Role for Their Membership Level →

Paid Memberships Pro is recommended by our customers and users

Plugin Reviews

4.3 out of 5

G2

4.8 out of 5

Capterra

5 out of 5

We’re 100% GPL

Our plugin's code is not obfuscated, runs on as many sites as you want and can be customized to fit your project's needs. We just ask that you follow the GPLv2 guidelines by applying the GPLv2 license to any altered or unaltered version of PMPro that you distribute. License Details »

GPL v2

Recent Articles and Updates

  • Featured image for code recipe 'Customize Login Error Messages to Boost Account Security'
    Customize Login Error Messages to Boost Account Security
  • Banner for Memberlite v6.0
    Introducing Memberlite v6.0
  • Screenshot of featured image for 'Capture User Fields for Google Analytics Integration Add On' code recipe post
    Capture User Fields as User Properties for Reporting in Google Analytics Integration Add On

Platform

  • Pricing
  • Features
  • Product Comparison
  • Reviews
  • Case Studies
  • Screenshots
  • Videos
  • Step-by-Step Guides

Use Cases

  • Associations
  • Blog & News
  • Community
  • Courses
  • Directory & Listing
  • Paid Newsletter
  • Podcast
  • Videos

Add Ons

  • Free
  • Standard
  • Plus
  • Admin
  • Integration
  • Payment
  • Third Party
  • View All

Get Help

  • Support
  • Documentation
  • Download & Install
  • Hosting
  • Developers
  • Blog
  • Slack Community
  • Contact Us

Company

  • About Us
  • Events
  • Brand Assets
  • Affiliates
  • Accessibility Statement
  • Sitemap
  • Privacy Policy
  • Terms of Service
Join Us On

© 2025 Paid Memberships Pro™. Paid Memberships Pro is a trademark of Stranger Studios, LLC. All Rights Reserved.

Open Office Hours: Ask Me Anything with Jason and Andrew • Thursday, May 15th at 11am ET. SEE DETAILS ▸