Forked from andrewlimaza/pmpro_allow_access_for_admins.php
Last active
September 11, 2023 18:31
-
-
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
This file contains hidden or 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 | |
/** | |
* 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