wp_login_url

Advertisement

Summery Summery

Retrieves the login URL.

Syntax Syntax

wp_login_url( string $redirect = '', bool $force_reauth = false )

Parameters Parameters

$redirect

(string) (Optional) Path to redirect to on log in.

Default value: ''

$force_reauth

(bool) (Optional) Whether to force reauthorization, even if a cookie is present.

Default value: false

Return Return

(string) The login URL. Not HTML-encoded.

Source Source

File: wp-includes/general-template.php

		echo apply_filters( 'loginout', $link );
	} else {
		/** This filter is documented in wp-includes/general-template.php */
		return apply_filters( 'loginout', $link );
	}
}

/**
 * Retrieves the logout URL.
 *
 * Returns the URL that allows the user to log out of the site.
 *
 * @since 2.7.0
 *
 * @param string $redirect Path to redirect to on logout.
 * @return string The logout URL. Note: HTML-encoded via esc_html() in wp_nonce_url().
 */
function wp_logout_url( $redirect = '' ) {
	$args = array();
	if ( ! empty( $redirect ) ) {
		$args['redirect_to'] = urlencode( $redirect );
	}

Advertisement

Changelog Changelog

Changelog
Version Description
2.7.0 Introduced.

Advertisement

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.