Created
May 15, 2017 21:04
-
-
Save strangerstudios/dd213f75c67935a447146ec430498c6d to your computer and use it in GitHub Desktop.
Change PMPro CPT to redirect to the login page instead of the chosen "Redirect To" page if the user is logged out.
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
/* | |
Change PMPro CPT to redirect to the login page instead of the chosen "Redirect To" page | |
if the user is logged out. | |
*/ | |
function my_pmprocpt_redirect_to($redirect_to) { | |
if(!is_user_logged_in()) { | |
$redirect_to = wp_login_url($_SERVER['REQUEST_URI']); | |
} | |
return $redirect_to; | |
} | |
add_action('pmprocpt_redirect_to', 'my_pmprocpt_redirect_to'); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment