MemberPress Code Snippets

MemberPress code snippet for use inside WordPress theme templates. Use this code to create conditional rules and control access to content based on MemberPress access levels.

Show or Hide Content Based on a MemberPress plugin Rule

			{ the_field( 'cta_video_embed' ); //for non-members
			{ the_field( 'premium_embed' ); // for members

An alternate way to show a video based on membership access is this:

<div> <?php if(MeprRule::is_allowed_by_rule(279)): the_field( 'premium_embed' ); endif; ?> </div>

MemberPress Login Logout Link

Add the following code snippet to your theme template file

<?php echo do_shortcode("[mepr-login-link]"); ?>

Hire WordPress Experts at Codeable.

The only WordPress exclusive freelancer platform that connects thousands of customers with the top WordPress freelance experts to work on projects of any size. 

Free estimate • No obligation to hire • 100% risk-free