Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save kimwhite/6238506f00fdc52c3d70ef18774e80d9 to your computer and use it in GitHub Desktop.
Save kimwhite/6238506f00fdc52c3d70ef18774e80d9 to your computer and use it in GitHub Desktop.
Allow admins, administrator, administrators access to all restricted posts in WordPress with Paid Memberships Pro - when using Divi editor also
<?php
/**
* This code snippet allows Editors without any PMPro membership level to access any restricted content.
* Add this code to your PMPro Customizations plugin -
* https://www.paidmembershipspro.com/create-a-plugin-for-pmpro-customizations/
*/
function pmmpro_allow_access_for_editors($hasaccess, $mypost, $myuser, $post_membership_levels){
//If user is an admin allow access.
if( current_user_can( 'edit_pages' ) ){
$hasaccess = true;
}
return $hasaccess;
}
add_filter('pmpro_has_membership_access_filter', 'pmmpro_allow_access_for_editors', 30, 4);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment