Advanced Custom Fields is a popular plugin available in the WordPress.org Plugin Repository. The plugin allows you to add structured information to your posts, pages, and more.
This guide explains three primary methods to hide or show fields based on the membership requirements for the post.

Option 1: The pmpro_hasMembershipLevel()
function.
Since the ACF plugin requires you to add custom PHP functions to your theme’s template files, one of the easiest ways to restrict the display of fields is to wrap your entire display in the pmpro_hasMembershipLevel()
function. Here’s an example of using the function in your template files:
You can read full documentation on the pmpro_hasMembershipLevel()
function here.
Option 2: The pmpro_has_membership_access()
function.
Similar to the option above, this method will look to the post’s required membership levels. You won’t need to specify the level IDs when using this function, it will inherit the membership protection from the “Require Membership” metabox for that post. Here’s an example of using the function in your template files:
Option 3: The acf/format_value
Filter
If you’re using version 5+ of the Advanced Custom Fields plugin, you can write a single function that will filter all fields on a member-protected page. This code will uses the acf/format_value
filter to check first if the user has access to the post and will then optionally restrict the display of the field.
Note that this will not restrict the display of any custom HTML you have in your page templates, but it is a simple solution that won’t require editing all of your theme files.
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.