From d507f27ce9622855ce1d880a38d22ad74bdff096 Mon Sep 17 00:00:00 2001 From: Chris Huber Date: Mon, 6 Apr 2026 06:02:44 +0000 Subject: [PATCH] Discussion settings: save 'closed' instead of empty string when pingback/comment checkboxes are unchecked When the 'Allow link notifications' or 'Allow comments' checkboxes are unchecked in Settings > Discussion, the form submits without those fields. The generic handler in options.php saves null, which update_option stores as an empty string. This causes problems because: - The REST API schema only accepts 'open' or 'closed' for ping_status and comment_status, rejecting empty strings with a 400 error - Gutenberg's Real-Time Collaboration feature round-trips the full entity record through REST on page load, exposing this as a visible error - MySQL strict mode configurations crash on NULL for NOT NULL columns The fix adds hidden inputs before each checkbox so that unchecking submits 'closed' instead of nothing. When checked, the checkbox value 'open' overrides the hidden input. This is the standard HTML pattern used elsewhere in WordPress. --- src/wp-admin/options-discussion.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/wp-admin/options-discussion.php b/src/wp-admin/options-discussion.php index 0c350475fe176..de688face3031 100644 --- a/src/wp-admin/options-discussion.php +++ b/src/wp-admin/options-discussion.php @@ -52,10 +52,12 @@