When members log out of your site, the experience should feel intentional. By default, WordPress redirects users to the standard login page, rarely the right destination for a membership site. You may want members to land on a custom “see you soon” page, a re-engagement offer, or a page specific to their membership level.
These code recipes use the WordPress wp_logout action to redirect users to a custom destination after logout. Choose a single destination for everyone, or send users to different pages depending on their membership level.
Do You Need This Recipe?
This recipe is a good fit if:
- You want to send members to a specific page after logout rather than the default WordPress login screen
- You want to show different post-logout pages to members of different levels (for example, sending Gold members to a retention offer and non-members elsewhere)
- Your PMPro login page is branded and you want members to land there after logout so they can log back in easily
If the default WordPress logout behavior is acceptable for your site, no recipe is needed.

Understanding the wp_logout Hook
These recipes are triggered by the wp_logout WordPress hook, which fires automatically whenever a user logs out of your site. You can use it to run custom PHP code, most commonly to redirect users to a specific page or display a custom message after logout.
About The Code Recipes
These two recipes cover the two most common use cases and work independently. Use one or the other depending on your needs.
- Recipe 1 redirects users based on their membership level at the moment of logout. Members with a specific level go to one page; everyone else goes to another.
- Recipe 2 sends all users to the same destination after logout, regardless of membership status. Useful when you want a single branded logout landing page for everyone.
Recipe 1: Redirect Based on Membership Level
To customize this recipe:
- Change the membership level ID
1on line 21 to your preferred membership level ID. - Replace
/level-1on line 22 with the slug of the page to redirect members of that level to after logout. - Replace
/other-levelson line 26 with the slug of the page for non-members and members on other levels. - To handle additional levels, chain
elseif ( pmpro_hasMembershipLevel( X, $user_id ) )blocks before the finalelse, each with its own redirect destination.
Recipe 2: Redirect All Users to the Same Page
To customize this recipe:
- Replace
home_url()on line 18 withhome_url( 'your-page-slug' )to redirect to a specific page. For example,home_url( 'login' )sends users to a page with the slug/login. - To always redirect to your configured PMPro login page regardless of its slug, use
pmpro_url( 'login' )instead ofhome_url().
Adding the Recipe to Your Website
You can add this recipe to your site by creating a custom plugin or using the Code Snippets plugin available for free in the WordPress repository. Read this companion article for step-by-step directions on either method.
Related Resources
- Best Practices for Member Log In and Log Out
- How to Redirect Members on Login and Why You Should
- Login Redirection: Redirect Members to Pages Based on Their Level
- pmpro_has_membership_level
- How to Add Code to WordPress Using the Code Snippets Plugin
- 7 Must-Have Pages for a Successful Membership Site


