Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kimcoleman/ab665d158f683f4a23e944b53d8ea269 to your computer and use it in GitHub Desktop.
Save kimcoleman/ab665d158f683f4a23e944b53d8ea269 to your computer and use it in GitHub Desktop.
Display Advanced Custom Fields for Levels 1 and 2 only.
// Display Advanced Custom Fields for Levels 1 and 2 only.
if ( function_exists( 'get_field' ) && function_exists( 'pmpro_hasMembershipLevel' ) ) {
if( pmpro_hasMembershipLevel( array('1', '2' ) ) ) {
if ( get_field( 'test_field_1' ) ) {
the_field( 'test_field_1' );
}
if ( get_field( 'test_field_2' ) ) {
the_field( 'test_field_2' );
}
}
}
@laurenhagan0306
Copy link

This recipe is included in the blog post on "Restrict the display of Advanced Custom Fields (ACF) fields by Membership Level" at Paid Memberships Pro here: https://www.paidmembershipspro.com/restrict-the-display-of-advanced-custom-fields-acf-fields-by-membership-level/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment