By default, Paid Memberships Pro uses the the_content filter to hide member content from non-members. When a non-member lands on a piece of restricted content, they are shown a message as set under Memberships > Advanced Settings.
This recipe shows you how to redirect away from members-only content. It’s a useful approach if you want to completely hide the existence of the post or for theme or plugin conflicts.
About the Recipe
Some themes (especially video/image/media-based themes) don’t display the main content through the the_content function. For these kinds of pages/themes, you can edit your theme to wrap sensitive bits using the pmpro_hasMembershipLevel() function or you can simply redirect non-members from the page entirely. We also have another tutorial that covers some known theme or page-builder conflicts that may be useful in your troubleshooting.
The Code Recipe
We are considering making this an option in the plugin settings, but for now you can redirect non-members away from member content using the code below.
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.
Get Support From Our Team of Experts
For more help with this PMPro feature, check out our Support Page with three ways to get support as a free or premium member.


