Elementor is a popular page builder that’s natively supported in Paid Memberships Pro. With this integration, you can select one or more membership levels to restrict content at the element, container, or widget level.

If you have loads of levels, though, this recipe is designed to simplify protecting content in Elementor. By grouping specific levels together, you can protect content for several membership levels with a single setting. And if your levels change in the future, you simply need to update the code recipe (not edit every piece of content).

Banner Image for Group Specific Levels in Elementor Code Recipe

About the Code Recipe

In this code, we add a new selection “My Custom Levels Group” to the Require Membership Level setting on the Advanced tab of the Elementor editor.

Screenshot in Elementor under Advanced Settings for Custom Level Group selection

Then in the custom code, you can set up the logic for which specific membership level IDs can see the content. This is helpful if you are adding new levels to your site and do not want to go back in and edit all of your Elementor content.

The Code Recipe (PHP)

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.

Customize this code recipe by adjusting the level IDs on line 35. Or, create additional custom levels groups by duplicating line 21 and the custom group setting on lines 33 to 38. This is helpful if you have multiple tiers of membership that share the same access.

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