Skip to content

Instantly share code, notes, and snippets.

@strangerstudios
Created May 15, 2017 21:04
Show Gist options
  • Select an option

  • Save strangerstudios/dd213f75c67935a447146ec430498c6d to your computer and use it in GitHub Desktop.

Select an option

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