Nonce-backed anonymous preview and PRC expiration overrides.
Flow
- Editor enables preview → AJAX
public-post-previewenrolls the post ID and sets_ppp_enabled. - Preview URL includes query arg
_ppp(custom nonce) for the post. - On the frontend,
pre_get_posts+ nonce verification grant anonymous access to that draft for the nonce lifetime. - Publishing or unregistering clears enrollment and meta.
Expiration model
| Source | Behavior |
|---|---|
Option public_post_preview_expiration_time | Site default in hours (Reading UI edits days) |
Constant DEFAULT_EXPIRATION_HOURS | 45 * 24 when the option is unset |
Post meta _ppp_expiration_hours | Per-post override; capped at 2160 hours (90 days) |
Filter ppp_nonce_life | Absolute nonce lifetime in seconds; hides Reading UI when present |
Nonce creation uses a tick size of half the lifetime (WordPress-style nonce ticking) so links remain valid for the configured window.
Post meta
| Meta key | Role |
|---|---|
_ppp_enabled | Whether public preview is on for the post |
_ppp_expiration_hours | Optional per-post lifetime override |
Extension filters
Notable filters (see source for full set): ppp_post_types, ppp_published_statuses, ppp_preview_link, ppp_nonce_life, ppp_nonce_life_compat, action ppp_show_public_preview.