Commit d507f27
committed
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.1 parent 609f25f commit d507f27
1 file changed
Lines changed: 2 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
52 | 52 | | |
53 | 53 | | |
54 | 54 | | |
| 55 | + | |
55 | 56 | | |
56 | 57 | | |
57 | 58 | | |
58 | 59 | | |
| 60 | + | |
59 | 61 | | |
60 | 62 | | |
61 | 63 | | |
| |||
0 commit comments