hotfix/cp-12676-cleverpush-wordpress-plugin-not-saving-scheduled-push
[!NOTE]
Medium Risk
Changes core publish/save notification flows and adds remote API create/delete on every draft save; wrong meta or cron handling could miss or duplicate pushes, but scope stays within CleverPush notification delivery.
Overview
Fixes scheduled CleverPush notifications not surviving saves and not firing when WordPress publishes (including cron-driven scheduled posts).
Scheduling in the editor now keeps the hidden cleverpush_scheduled_at in sync with the datetime picker on submit and Gutenberg save, clears both fields when push is disabled, and only writes schedule meta when the metabox was actually submitted—so saves no longer wipe a stored schedule.
Publish path reads saved meta for send flag, custom title/text, and future scheduledAt when the metabox is not in the request (typical on scheduled publish), and allows publish_post to run under cron when a send was previously saved.
CleverPush draft sync creates or updates remote draft notifications for unpublished posts (with hash-based dedup), removes them when push is unchecked or after a successful send, via new delete_notification API support. Plugin version 1.9.9.
Reviewed by Cursor Bugbot for commit f2885553952d1e93cb22ff8c0821d56909dd221c. Bugbot is set up for automated code reviews on this repo. Configure here.
Summary by cubic
Fixes the scheduled push notification flow so schedules persist and fire on publish without losing draft state.
- Adds draft notification sync when saving drafts, future, or pending posts, and deletes the draft once the post is published.
- Sends scheduled pushes for WordPress-scheduled posts and falls back to saved metadata when the metabox isn't submitted for form-less publishing.
- Allows cron-based publishing to send notifications without the user capability check.
- Fixes the scheduling field syncing between the date picker and the hidden input, including on save.
- Bumps plugin version to 1.9.9 and adds API support for deleting notification drafts.