Sync and async lifecycle hooks for web and REST contexts.
Design
WordPress status transitions are noisy. This plugin normalizes them into predictable actions and skips WP-CLI on purpose — pipeline hooks are for web/REST contexts only.
Lifecycle tiers
Sync tier
Runs during the save request. Use for mutations, cache invalidation, and anything the editor or frontend must see immediately.
| Hook | Fires when |
|---|---|
prc_platform_on_post_init | New post first created |
prc_platform_on_incremental_save | Saved while draft or publish |
prc_platform_on_publish | Transitions to publish |
prc_platform_on_update | Already-published post updated |
prc_platform_on_unpublish | Leaves publish |
prc_platform_on_trash / prc_platform_on_untrash | Trash / restore |
prc_platform_on_status_transition | Catch-all ($post, $current, $prior, $has_blocks) |
Per-post-type variants exist: prc_platform_on_{post_type}_publish, and so on.
Async tier
For terminal lifecycle events, the pipeline enqueues Action Scheduler job prc_platform_post_publish_pipeline_async_dispatch (group prc-post-publish-pipeline) and fires parallel async hooks with a freshly loaded post: prc_platform_async_on_publish, _update, _unpublish, _trash, _untrash, _incremental_save.
prior_status is not available on async hooks. The pipeline does not auto-enqueue incremental_save; consumers enqueue it from sync when work should be deferred.
\PRC\Platform\Post_Publish_Pipeline\enqueue_async_event( $post_id, 'publish' );
Supported events: publish, update, unpublish, untrash, trash, incremental_save.
JavaScript actions
Editor script dispatches @wordpress/hooks actions such as prc-platform.onPostInit, onIncrementalSave, onPublish, onUpdate, onUnpublish, onStatusTransition, and onSiteEdit. Payload shape includes edits, postId, postType, postStatus, priorStatus, isSiteEditor where applicable.
Allowed post types
Default tracked types include post, feature, quiz, fact-sheet, short-read, events, mini-course, press-release, block_module, collections. Extend with:
add_filter( 'prc_platform_post_publish_pipeline_post_types', function ( $types ) {
$types[] = 'my-cpt';
return $types;
} );
Skip processing for a write with prc_platform_post_publish_pipeline_should_process (return false).