Automattic\WooCommerce\Admin\Features\ProductBlockEditor

RedirectionController::maybe_redirect_to_old_editor()publicWC 1.0

Redirects from new product form to the old product form if the feature product_block_editor is enabled.

Method of the class: RedirectionController{}

No Hooks.

Return

null. Nothing (null).

Usage

$RedirectionController = new RedirectionController();
$RedirectionController->maybe_redirect_to_old_editor(): void;

RedirectionController::maybe_redirect_to_old_editor() code WC 9.0.1

public function maybe_redirect_to_old_editor(): void {
	$route = $this->get_parsed_route();

	if ( 'add-product' === $route['page'] ) {
		wp_safe_redirect( admin_url( 'post-new.php?post_type=product' ) );
		exit();
	}

	if ( 'product' === $route['page'] ) {
		wp_safe_redirect( admin_url( 'post.php?post=' . $route['product_id'] . '&action=edit' ) );
		exit();
	}
}