wc_lostpassword_url()
Returns the url to the lost password endpoint url.
No Hooks.
Return
String
.
Usage
wc_lostpassword_url( $default_url );
- $default_url(string)
- Default lost password URL.
Default: ''
wc_lostpassword_url() wc lostpassword url code WC 9.4.2
function wc_lostpassword_url( $default_url = '' ) { // Avoid loading too early. if ( ! did_action( 'init' ) ) { return $default_url; } // Don't change the admin form. if ( did_action( 'login_form_login' ) ) { return $default_url; } // Don't redirect to the woocommerce endpoint on global network admin lost passwords. if ( is_multisite() && isset( $_GET['redirect_to'] ) && false !== strpos( wp_unslash( $_GET['redirect_to'] ), network_admin_url() ) ) { // WPCS: input var ok, sanitization ok, CSRF ok. return $default_url; } $wc_account_page_url = wc_get_page_permalink( 'myaccount' ); $wc_account_page_exists = wc_get_page_id( 'myaccount' ) > 0; $lost_password_endpoint = get_option( 'woocommerce_myaccount_lost_password_endpoint' ); if ( $wc_account_page_exists && ! empty( $lost_password_endpoint ) ) { return wc_get_endpoint_url( $lost_password_endpoint, '', $wc_account_page_url ); } else { return $default_url; } }