Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Update WooCommerce sites to use the account page to login rather than wp-login.php
<?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