This post covers some options for customizing the message a non-member (either logged in or logged out) sees when trying to access a piece of members-only content.

Banner Image for Code Recipe Customizing the Message for Non-Members on Membership Protected Content

Customizing the Default Messages

In your WordPress admin, navigate to Memberships > Settings > Advanced Settings. Locate the “Message Settings” section and you will see three separate message customization options:

  • Message for Logged-in Non-members
    This message replaces the post content for non-members. Available variables: !!levels!!, !!referrer!!, and !!levels_page_url!!
  • Message for Logged-out Users
    This message replaces the post content for logged-out visitors. Available variables: !!levels!!, !!referrer!!, !!login_page_url!! and !!levels_page_url!!
  • Message for RSS Feed
    This message replaces the post content in RSS feeds. Available variable: !!levels!!

These messages will show on the single page/post as well as in the index/search/archive view if you have the setting Filter searches and archives? set to Yes. For more information about excerpts, please read the full guide on Excerpts and the “Read More” tag for Posts and Pages.

Member Content Message with Memberlite Theme

Custom HTML for Displaying the Message

You can use full HTML within the message fields if you want to add your theme’s custom message or button classes, or use any other HTML tags in the content. The message will be output in your page using the HTML markup below by default:

<div class="pmpro_content_message">
//custom message here

You can add custom CSS to your site to target this div using one of the methods outline in this guide. For example, if you are using Elementor you may see that this message displays at the full width of your page. You can use custom CSS like the following to give the content a subtle grey background and set a maximum width:

.pmpro_content_message {
	background: #F1F1F1;
	margin: 0 auto;
	max-width: 700px;
	padding: 15px;

Using Advanced Filters

On our site, we override this setting with a custom function. Here are two code recipes that you will need to customize to show a unique message based on the logged-in user’s membership level or for a not logged in visitor.

For Logged In Non-Members

For Not Logged In Visitors

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.

Then modify the level IDs and messages for your needs.

Was this article helpful?