Skip to content

Instantly share code, notes, and snippets.

@dparker1005
Created November 20, 2020 16:53
Show Gist options
  • Save dparker1005/736eaed08ed895ab29f951ab0861db5c to your computer and use it in GitHub Desktop.
Save dparker1005/736eaed08ed895ab29f951ab0861db5c to your computer and use it in GitHub Desktop.
Redirect logout to PMPro login page.
<?php
// Copy from below here...
/*
* Redirect logout to PMPro login page.
*/
function my_logout_url_redirect_pmpro( $logout_url ) {
global $pmpro_pages;
if ( ! empty( $pmpro_pages['login'] ) ) {
$logout_url .= '&redirect_to=' . urlencode( get_permalink( $pmpro_pages['login'] ) );
}
return $logout_url;
}
add_filter( 'logout_url', 'my_logout_url_redirect_pmpro' );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment