Created
September 3, 2018 20:43
-
-
Save andrija-naglic/8ed869affdaf80b1af9f71af75de01f0 to your computer and use it in GitHub Desktop.
WP MemberPress - get list of memberships that can access a restricted content
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
<?php | |
$the_post_object = get_post( $post_id ); | |
$access_list = MeprRule::get_access_list( $the_post_object ); | |
$product_ids = (isset($access_list['membership']) && !empty($access_list['membership'])) ? $access_list['membership'] : array(); | |
/* | |
$acces_list returns: ["membership" => [1,2], "member" =>["foo"]] | |
$products_ids contains an array of Membership IDs that can access this content | |
*/ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment