Guide

Public Post Preview architecture

Nonce-backed anonymous preview and PRC expiration overrides.

Flow

  1. Editor enables preview → AJAX public-post-preview enrolls the post ID and sets _ppp_enabled.
  2. Preview URL includes query arg _ppp (custom nonce) for the post.
  3. On the frontend, pre_get_posts + nonce verification grant anonymous access to that draft for the nonce lifetime.
  4. Publishing or unregistering clears enrollment and meta.

Expiration model

SourceBehavior
Option public_post_preview_expiration_timeSite default in hours (Reading UI edits days)
Constant DEFAULT_EXPIRATION_HOURS45 * 24 when the option is unset
Post meta _ppp_expiration_hoursPer-post override; capped at 2160 hours (90 days)
Filter ppp_nonce_lifeAbsolute 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 keyRole
_ppp_enabledWhether public preview is on for the post
_ppp_expiration_hoursOptional 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.

Was this helpful?