Automattic\WooCommerce\Admin\Features\ProductBlockEditor

RedirectionController::maybe_redirect_to_new_editor()publicWC 1.0

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

Метод класса: RedirectionController{}

Хуков нет.

Возвращает

null. Ничего (null).

Использование

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

Код RedirectionController::maybe_redirect_to_new_editor() WC 9.7.1

public function maybe_redirect_to_new_editor(): void {
	if ( $this->is_legacy_add_new_screen() ) {
		wp_safe_redirect( admin_url( 'admin.php?page=wc-admin&path=/add-product' ) );
		exit();
	}

	if ( $this->is_legacy_edit_screen() ) {
		$product_id = isset( $_GET['post'] ) ? absint( $_GET['post'] ) : null;
		if ( ! $this->is_product_supported( $product_id ) ) {
			return;
		}
		wp_safe_redirect( admin_url( 'admin.php?page=wc-admin&path=/product/' . $product_id ) );
		exit();
	}
}