Commit b50f5093d54 for woocommerce
commit b50f5093d547fd6cfde6ef0c54b2d8a470efb570
Author: Ján Mikláš <neosinner@gmail.com>
Date: Wed Nov 25 11:25:39 2026 +0100
Fix WP-CLI admin startup with HPOS enabled (#71377)
* Fix WP-CLI admin startup with HPOS enabled
* Add changelog entry for WP-CLI admin startup fix
diff --git a/plugins/woocommerce/changelog/fix-71288-wp-cli-admin-hpos b/plugins/woocommerce/changelog/fix-71288-wp-cli-admin-hpos
new file mode 100644
index 00000000000..c6974d78ad9
--- /dev/null
+++ b/plugins/woocommerce/changelog/fix-71288-wp-cli-admin-hpos
@@ -0,0 +1,4 @@
+Significance: patch
+Type: fix
+
+Prevent WP-CLI commands in admin context from crashing when High-Performance Order Storage is enabled.
diff --git a/plugins/woocommerce/includes/react-admin/connect-existing-pages.php b/plugins/woocommerce/includes/react-admin/connect-existing-pages.php
index e4666c14d09..854b89f7f9a 100644
--- a/plugins/woocommerce/includes/react-admin/connect-existing-pages.php
+++ b/plugins/woocommerce/includes/react-admin/connect-existing-pages.php
@@ -155,7 +155,7 @@ wc_admin_connect_page(
)
);
-if ( OrderUtil::custom_orders_table_usage_is_enabled() ) {
+if ( OrderUtil::custom_orders_table_usage_is_enabled() && function_exists( 'wc_get_page_screen_id' ) ) {
// WooCommerce > Orders (COT).
wc_admin_connect_page(
array(