Commit c164775b051 for woocommerce
commit c164775b05180bdc1c3479b711bd34ee8f0ad7c5
Author: Yuliyan Slavchev <yuliyan.slavchev@gmail.com>
Date: Thu Aug 27 12:37:54 2026 +0300
Validate the return of the email editor preload routes filter (#68021)
diff --git a/packages/php/email-editor/changelog/fix-preload-routes-filter-guard b/packages/php/email-editor/changelog/fix-preload-routes-filter-guard
new file mode 100644
index 00000000000..f4d5a4a2564
--- /dev/null
+++ b/packages/php/email-editor/changelog/fix-preload-routes-filter-guard
@@ -0,0 +1,4 @@
+Significance: patch
+Type: fix
+
+Guard against non-array return values from the woocommerce_email_editor_preload_rest_api_routes filter.
diff --git a/packages/php/email-editor/src/Engine/class-assets-manager.php b/packages/php/email-editor/src/Engine/class-assets-manager.php
index 7e3a7de0198..555fdb5087b 100644
--- a/packages/php/email-editor/src/Engine/class-assets-manager.php
+++ b/packages/php/email-editor/src/Engine/class-assets-manager.php
@@ -251,6 +251,10 @@ class Assets_Manager {
*/
$routes = apply_filters( 'woocommerce_email_editor_preload_rest_api_routes', $routes, $post_type, $post_id );
+ if ( ! is_array( $routes ) ) {
+ $routes = array();
+ }
+
$preload_data = array_reduce(
$routes,
'rest_preload_api_request',