Root Cause:
Unchecked HTML checkboxes are not sent in POST data. When “Display upcoming events” was unchecked, the future parameter wasn’t in the POST request. The AJAX handler then used the block.json default (future=true) instead of treating it as false. This resulted in both future=true and past=true, showing all events.
Solution:
Modified AJAX handlers (ajaxlist & ajaxTimeline in eventpost.php) to convert checkbox state to proper booleans:
php
// Before: ‘future’ => esc_attr(FILTER_INPUT(INPUT_POST, ‘future’)),
// After:
‘future’ => FILTER_INPUT(INPUT_POST, ‘future’) ? true : false,
‘past’ => FILTER_INPUT(INPUT_POST, ‘past’) ? true : false,
Now unchecked checkboxes properly become false instead of defaulting to true.
Result: “Display past events” checkbox now correctly shows ONLY past events (future=false, past=true).