Skip to content

Instantly share code, notes, and snippets.

@strangerstudios
Created May 15, 2017 21:04
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save strangerstudios/dd213f75c67935a447146ec430498c6d to your computer and use it in GitHub Desktop.
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.
/*
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