WP_Recovery_Mode_Link_Service::handle_begin_link() WordPress Method

The WP_Recovery_Mode_Link_Service::handle_begin_link() method is used to initiate the process of creating a recovery mode link for a WordPress site. This method takes two parameters: the URL of the site to be linked and the email address of the administrator.

WP_Recovery_Mode_Link_Service::handle_begin_link( int $ttl ) #

Enters recovery mode when the user hits wp-login.php with a valid recovery mode link.


Parameters

$ttl

(int)(Required)Number of seconds the link should be valid for.


Top ↑

Source

File: wp-includes/class-wp-recovery-mode-link-service.php

	public function handle_begin_link( $ttl ) {
		if ( ! isset( $GLOBALS['pagenow'] ) || 'wp-login.php' !== $GLOBALS['pagenow'] ) {
			return;
		}

		if ( ! isset( $_GET['action'], $_GET['rm_token'], $_GET['rm_key'] ) || self::LOGIN_ACTION_ENTER !== $_GET['action'] ) {
			return;
		}

		if ( ! function_exists( 'wp_generate_password' ) ) {
			require_once ABSPATH . WPINC . '/pluggable.php';
		}

		$validated = $this->key_service->validate_recovery_mode_key( $_GET['rm_token'], $_GET['rm_key'], $ttl );

		if ( is_wp_error( $validated ) ) {
			wp_die( $validated, '' );
		}

		$this->cookie_service->set_cookie();

		$url = add_query_arg( 'action', self::LOGIN_ACTION_ENTERED, wp_login_url() );
		wp_redirect( $url );
		die;
	}


Top ↑

Changelog

Changelog
VersionDescription
5.2.0Introduced.

The content displayed on this page has been created in part by processing WordPress source code files which are made available under the GPLv2 (or a later version) license by theĀ Free Software Foundation. In addition to this, the content includes user-written examples and information. All material is subject to review and curation by the WPPaste.com community.