Dev Resources

  • Home
  • Reference
  • BuddyX Theme
  • Functions
  • Hooks
  • Classes
Filter by type:
Search
Browse: Home / Reference / Functions / wc_lostpassword_url()

wc_lostpassword_url( string $default_url = '' )

Returns the url to the lost password endpoint url.

Contents

  • Description
    • Parameters
    • Return
    • Source
  • Related
    • Uses
    • Used By
  • User Contributed Notes

Description #Description


Parameters #Parameters

$default_url

(Optional) Default lost password URL.

Default value: ''


Top ↑

Return #Return

(string)


Top ↑

Source #Source

File: includes/wc-account-functions.php

function wc_lostpassword_url( $default_url = '' ) {
	// Avoid loading too early.
	if ( ! did_action( 'init' ) ) {
		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;
	}
}

Expand full source code Collapse full source code


Top ↑

Related #Related

Top ↑

Uses #Uses

Uses
Uses Description
includes/wc-page-functions.php: wc_get_page_permalink()

Retrieve page permalink.

includes/wc-page-functions.php: wc_get_page_id()

Retrieve page ids – used for myaccount, edit_address, shop, cart, checkout, pay, view_order, terms. returns -1 if no page is found.

includes/wc-page-functions.php: wc_get_endpoint_url()

Get endpoint URL.

Top ↑

Used By #Used By

Used By
Used By Description
includes/class-wc-form-handler.php: WC_Form_Handler::redirect_reset_password_link()

Remove key and user ID (or user login, as a fallback) from query string, set cookie, and redirect to account page to show the form.

includes/wc-deprecated-functions.php: woocommerce_lostpassword_url()

Top ↑

User Contributed Notes #User Contributed Notes

You must log in before being able to contribute a note or feedback.

Proudly powered by WordPress