-
-
Save dparker1005/5873c84aa07ebfaf415949c192d68e06 to your computer and use it in GitHub Desktop.
Fix password reset behavior when using PMPro login page on WP Engine hosting.
This file contains hidden or 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 | |
// Copy from below here... | |
/* | |
* In addition to adding this code to your site, note that | |
* WP Engine also has aggressive caching that your login page | |
* should be excluded from, especially if you experience issues | |
* with your login page. | |
* https://wpengine.com/support/cache/#Cache_Exclusions | |
*/ | |
/** | |
* Add wpe-login parameter when sending lost password email. | |
*/ | |
function my_pmpro_fix_wpe_lostpass( $url ) { | |
$url = add_query_arg( 'wpe-login', true, $url ); | |
return $url; | |
} | |
add_filter( 'lostpassword_url', 'my_pmpro_fix_wpe_lostpass' ); | |
/** | |
* Add wpe-login parameter when resetting password. | |
*/ | |
function my_pmpro_fix_wpe_resetpass( $url, $path ) { | |
if ( strpos( $path, 'action=resetpass' ) !== false && strpos( $path, 'wpe-login=true' ) === false ) { | |
$url = add_query_arg( 'wpe-login', 'true', $url ); | |
} | |
return $url; | |
} | |
add_filter( 'site_url', 'my_pmpro_fix_wpe_resetpass', 10, 2 ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment