Last active
August 3, 2018 03:45
-
-
Save cameronjonesweb/d7e5796472051e25738c9c42fd6737d6 to your computer and use it in GitHub Desktop.
Update WooCommerce sites to use the account page to login rather than wp-login.php
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
<?php | |
add_filter( 'login_url', 'cameronjonesweb_use_woocommerce_login_page' ); | |
/** | |
* If WooCommerce is active use the account page for logging in | |
* @param string $login_url The URL for login. | |
* @param string $redirect The URL to redirect back to upon successful login. | |
* @param bool $force_reauth | |
* @return string | |
*/ | |
function cameronjonesweb_use_woocommerce_login_page( $login_url ) { | |
if( function_exists( 'is_woocommerce' ) && $wc_account_page = get_permalink( get_option( 'woocommerce_myaccount_page_id' ) ) ) { | |
$login_url = $wc_account_page; | |
} | |
return $login_url; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment