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);
Parameters
- $hasaccess
- bool; Return true or false if the user has access to the content.
- $mypost
- object; The current WP_Post object.
- $myuser
- object; The current WP_User object.
- $post_membership_level
- array; The levels this content is protected for or empty if the content is not protected.
Source
File: https://github.com/strangerstudios/paid-memberships-pro/blob/master/includes/content.php
View in Source CodeRelated Articles and Recipes
Block or Pause a Specific Member’s Access to Restricted Content By Sam Daugherty
Unlocking Content on Specific Dates With PMPro: Series Add On Alternative By PMPro Team
Unlock Membership Access to All Restricted Content Without Updating Posts By Andrew Lima
Hide Previous Content From New Members By Jason Coleman
How to Allow Visitor Access to Specific Posts in a Membership-Restricted Category By Kim Coleman
Allow Authors to View Their Posts Regardless of Membership Level By Kim Coleman
Lock or Unlock Posts Based on Age and Post Date By Kim Coleman
Lock Posts to Members-Only After Specific Timeframe By Kim Coleman
Sister Plugin for Addon Packages: Apply Parent Page’s Protection to All Child Pages By Kim Coleman
Sell Access to Post Categories “a la carte” Using Price-Adjusting User Fields By Kim Coleman
Sell Access to a Single Post Category Using the Addon Packages Plugin By Jason 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 to 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.