Commit 18802a66b2c for woocommerce
commit 18802a66b2c27adca830c46d069d960fd7bdf1d5
Author: Seun Olorunsola <30554163+triple0t@users.noreply.github.com>
Date: Fri Nov 27 08:48:50 2026 +0100
Email editor: keep emails out of the WordPress 7.2 /random/ URL (#71496)
Email editor: keep email post types out of the WordPress 7.2 /random/ URL
WordPress 7.2 makes a post type randomable by default when it is
publicly_queryable and has an archive (wp-includes/class-wp-post-type.php:608
in 7.2-RC3). Email post types set both, so /random/woo_email/ sent visitors
to a random published email.
diff --git a/packages/php/email-editor/changelog/fix-email-post-types-randomable b/packages/php/email-editor/changelog/fix-email-post-types-randomable
new file mode 100644
index 00000000000..192ed955de9
--- /dev/null
+++ b/packages/php/email-editor/changelog/fix-email-post-types-randomable
@@ -0,0 +1,4 @@
+Significance: patch
+Type: fix
+
+Keep emails out of the /random/ link that WordPress 7.2 adds, so visitors are not sent to an email page.
diff --git a/packages/php/email-editor/src/Engine/class-email-editor.php b/packages/php/email-editor/src/Engine/class-email-editor.php
index b79e7f8f94a..871c8472407 100644
--- a/packages/php/email-editor/src/Engine/class-email-editor.php
+++ b/packages/php/email-editor/src/Engine/class-email-editor.php
@@ -292,6 +292,7 @@ class Email_Editor {
'show_in_rest' => true, // Important to enable Gutenberg editor.
'default_rendering_mode' => 'template-locked',
'publicly_queryable' => true, // required by the preview in new tab feature.
+ 'randomable' => false, // Keep emails out of the /random/ URL added in WordPress 7.2.
);
}