Paid Memberships Pro is built to restrict content on your site so only members can access the protected content. There are various ways to customize the restriction settings for non-members. 

This recipe removes the restricted content messages from the blog homepage. It’s particularly useful for sites that show blog posts in a grid layout with a small excerpt of post content. This will essentially clean up the user interface to ensure that your homepage remains welcoming and uncluttered for all visitors.

Banner image for Remove the Restricted Access on Blog Homepage

About the Code Recipe

This snippet targets and removes messages that typically alert non-members about content restrictions guiding them to either join the membership or login. 

If a user is on the homepage, the code recipe un-sets the content of the no access messages. On any other page, the default alerts will continue to function as set up in your Paid Memberships Pro settings, ensuring that content restrictions are communicated effectively.

The is_front_page() and is_home() functions determine if the current query is for the homepage of the site. Depending on your WordPress settings and the specific theme in use, these functions may return different results. Therefore, test the snippet accordingly to ensure it works as intended with your setup.

By adding this snippet, you maintain a pristine homepage while keeping the restriction notices on other pages. This balance ensures that potential members are informed about exclusive content without the initial distraction of restriction alerts upon arriving at your site.

Screenshots: Before and After

Screenshot of the restricted content message
Screenshot of blog post with restricted access message
Screenshot showing removed restricted content message
Screenshot of blog post without restricted access message

The Code Recipe

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.

Note: You may also want to use this code on tag or category archives, if posts are also displayed in a grid format per your theme.

Free Course: Membership Site Development—The Basics

Develop a deeper understanding of membership site development in this beginner-level course. Learn how to make your site work better, save yourself time and money, and improve your site's performance.

Featured Image for Membership Site Development Course: The Basics
Was this article helpful?
YesNo