Last active
November 24, 2020 22:48
-
-
Save strangerstudios/5913034 to your computer and use it in GitHub Desktop.
Redirect users away from posts requiring membership with Paid Memberships Pro.
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 | |
/* | |
Plugin Name: PMPro Customizations | |
Plugin URI: http://www.paidmembershipspro.com/wp/pmpro-customizations/ | |
Description: Customizations for Paid Memberships Pro | |
Version: .1 | |
Author: Stranger Studios | |
Author URI: http://www.strangerstudios.com | |
*/ | |
//redirect to login or homepage if user is logged out or not a member | |
function my_template_redirect_require_membership_access() | |
{ | |
if(!pmpro_has_membership_access()) | |
{ | |
wp_redirect(pmpro_url("levels")); | |
exit; | |
} | |
} | |
add_action('template_redirect', 'my_template_redirect_require_membership_access'); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hi, the plugin not work if use learn dash. All pages and CPTs ok but in swfd-course not work redirect.