Created
June 19, 2018 18:22
-
-
Save kimcoleman/ab665d158f683f4a23e944b53d8ea269 to your computer and use it in GitHub Desktop.
Display Advanced Custom Fields for Levels 1 and 2 only.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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' ); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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/