Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save strangerstudios/81b86bebefe2d1fbe8516f7bb249c072 to your computer and use it in GitHub Desktop.
Save strangerstudios/81b86bebefe2d1fbe8516f7bb249c072 to your computer and use it in GitHub Desktop.
Make sure authors can always see their own posts with PMPro
/*
Make sure authors can always see their own posts.
Add this code to a custom plugin.
*/
function pmpro_has_membership_access_filter_for_authors($hasaccess, $mypost, $myuser, $post_membership_levels) {
if($mypost->post_author == $myuser->ID)
$hasaccess = true;
return $hasaccess;
}
add_filter('pmpro_has_membership_access_filter', 'pmpro_has_membership_access_filter_for_authors', 30, 4);
@laurenhagan0306
Copy link

This recipe is included in the blog post on "Allow Authors to View Their Posts Regardless of Membership Level" at Paid Memberships Pro here: https://www.paidmembershipspro.com/allow-authors-to-view-their-posts-regardless-of-membership-level/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment