Use this hook to filter the membership access of a given post. This overrides the output of the
pmpro_has_membership_access() function and returns the boolean true or false, the WP_Post object, the WP_User object, and an array of the membership levels required for the post.
apply_filters("pmpro_has_membership_access_filter", bool $hasaccess, WP_post $mypost, WP_user $myuser, array $post_membership_levels);
- bool; Return true or false if the user has access to the content.
- object; The current WP_Post object.
- object; The current WP_User object.
- array; The levels this content is protected for or empty if the content is not protected.
SourceView in Source Code
Related Articles and Recipes
Always Allow Admin Access to Member Restricted Posts By Kimberly Coleman
Block or Pause a Specific Member’s Access to Restricted Content By Kimberly Coleman
Hide Previous Content From New Members By Jason Coleman
Allow Authors to View Their Posts Regardless of Membership Level By Kimberly Coleman
Lock or Unlock Posts Based on Age and Post Date By Kimberly Coleman
Lock Posts to Members-Only After Specific Timeframe By Kimberly Coleman
Sell Access to Post Categories “a la carte” Using Price-Adjusting User Fields By Kimberly Coleman
How To Have a Paid Memberships Pro Level with Access to Everything By Jason Coleman
About Actions and Filters in PMPro
Hooks allow you to extend Paid Memberships Pro without editing any core plugin files. You can use a hook to program custom code that interacts with or modifies code in our plugin, Add Ons, your theme, and even WordPress itself.
There are two kinds of hooks: actions and filters.
- Action hooks allow you to run new custom code at pre-defined locations.
- Filter hooks allow you change or extend existing code by modifying the data and returning it back to the software.
Click here to browse the full database of action and filter hooks available in Paid Memberships Pro. For help extending our Add Ons, refer to the individual Add On's documentation page for a list of available hooks.
For more developer-focused information about Paid Memberships Pro, check out the advanced developer topics documentation.