Controlled Draft Publisher 1.7.6, gap between posts (12 Sep 2026)
Where it came from
Feature request on the WordPress.org support forum, 11 Sep 2026, from @gamark: "Gap between draft posting (idea)". They run news posts as drafts and did not want ten going live in the same second. https://wordpress.org/support/topic/gap-between-draft-posting-idea/
They were right. In 1.7.5 cdp_publish_draft() looped the whole batch and called wp_update_post on each one back to back, so Posts Per Run of 10 meant 10 posts published in the same second.
What was built
New setting Gap Between Posts (seconds), option cdp_gap_seconds, default 0 so existing installs behave exactly as before. Capped at 3600.
The first post of a run still publishes immediately. Each one after it is scheduled with wp_schedule_single_event at now + (position * gap) on a new cdp_publish_one hook.
Deliberately not implemented with sleep(). Ten posts at a ten second gap would block the request for 100 seconds and PHP would usually be killed around 30, publishing half the batch and losing the rest.
Four guards, all of which are the reason this took longer than the feature itself:
A queued post gets _cdp_publish_queued post meta and a matching NOT EXISTS clause was added to cdp_build_queue_query_args, so the next tick cannot pick the same draft up a second time.
cdp_publish_queued_post() re-checks the post before publishing. If it was published by hand, binned, or flagged excluded in the meantime, it is left alone.
cdp_release_stale_queued() runs at the top of every tick. A marker whose slot passed more than an hour ago, with no cron event still waiting, is cleared. Without this a draft could be locked out of the queue forever if cron never fired.
Deactivation clears both the cdp_publish_one events and the markers.
Email alerts: queued posts are not emailed one by one, which would mean ten emails. The run's single email lists what published now and what is queued, and says the queued ones appear in the log when they publish.
Honest caveat, stated in the UI and the readme
WP cron only fires when someone visits the site, so the gap is a minimum and not a guarantee. Both the setting description and a new FAQ entry say so, and point at a real server cron for accurate spacing.
Verification
php -l clean.
Logic proven with a standalone harness: gap 10 with 3 posts gives publish now, +10s, +20s. Gap 0 publishes all immediately, identical to 1.7.5. A single post with a gap set publishes immediately and queues nothing.