Automattic\WooCommerce\Admin\Features\ProductBlockEditor
RedirectionController::maybe_redirect_to_new_editor
Redirects from old product form to the new product form if the feature product_block_editor is enabled.
Method of the class: RedirectionController{}
No Hooks.
Returns
null. Nothing (null).
Usage
$RedirectionController = new RedirectionController(); $RedirectionController->maybe_redirect_to_new_editor(): void;
RedirectionController::maybe_redirect_to_new_editor() RedirectionController::maybe redirect to new editor code WC 10.6.2
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();
}
}