Automattic\WooCommerce\Blocks

BlockTypesController::redirect_to_field()publicWC 1.0

Adds a redirect field to the login form so blocks can redirect users after login.

Method of the class: BlockTypesController{}

No Hooks.

Return

null. Nothing (null).

Usage

$BlockTypesController = new BlockTypesController();
$BlockTypesController->redirect_to_field();

BlockTypesController::redirect_to_field() code WC 9.4.2

public function redirect_to_field() {
	// phpcs:ignore WordPress.Security.NonceVerification
	if ( empty( $_GET['redirect_to'] ) ) {
		return;
	}
	echo '<input type="hidden" name="redirect" value="' . esc_attr( esc_url_raw( wp_unslash( $_GET['redirect_to'] ) ) ) . '" />'; // phpcs:ignore WordPress.Security.NonceVerification
}