LeadFlow / WordPress approval workflow
A WordPress approval workflow plugin answers the one question roles, statuses and staging sites cannot: is the text about to publish the exact text that was signed off? What follows is the mechanism, the free plugin that implements it, and the cases it does not cover. A writer drafts, a reviewer signs it off, and an hour before launch somebody fixes "just a typo" - except the typo was the price in the third paragraph. The post still says approved. It still publishes. The approval was a flag with no memory of what it approved.
| What the site has | What it proves | What it misses |
|---|---|---|
A status like approved, or "Editor can publish" | That somebody pressed a button at some point | Whether the text in the row is the text that was on screen then |
| Revisions | History exists after the fact | Nothing stops the write; you find out from a client email |
| A staging site | A copy existed somewhere | Production still accepts any edit, from anyone, at any time |
| A hash of title + content + excerpt taken at approval | That this exact text was signed off | Edits, and nothing else - see the limits below |
The first three answer "was this workflow followed?". Only the fourth answers "is this the text that was approved?".
Giving publish rights only to a reviewer controls who can publish. It says nothing about what. In practice the reviewer is the one making the last-minute edit half the time, and a second administrator - the agency, the VA, the intern with an app password - goes around the reviewer completely.
The same hole exists in the other direction: an automation that gates publishing with an approval step is bypassed the moment a human publishes from wp-admin. If the check lives in the automation, the site is only protected for the people who use the automation.
post_title + post_content + post_excerpt together, in post meta.draft.The hook is the whole argument for this design: wp_insert_post_data runs for the classic editor, the block editor, the REST API, quick edit and bulk edit. A save that goes through WordPress goes through that filter, which is why the check belongs there and not in an admin-side validation or a JavaScript guard.
// Simplified excerpt - the plugin does the bookkeeping around this.
add_filter( 'wp_insert_post_data', function ( $data, $postarr ) {
$post_id = (int) ( $postarr['ID'] ?? 0 );
if ( ! $post_id || 'publish' !== $data['post_status'] ) {
return $data; // only a publish attempt is gated
}
$approved = get_post_meta( $post_id, '_sag_approved_hash', true );
if ( '' === $approved ) {
return $data; // never approved: not this check's business
}
$current = hash( 'sha256',
$data['post_title'] . "\n" . $data['post_content'] . "\n" . $data['post_excerpt']
);
if ( empty( $approved ) || ! hash_equals( $approved, $current ) ) {
$data['post_status'] = 'draft'; // publish refused
set_transient( 'sag_blocked_' . $post_id, array(
'approved' => $approved,
'current' => $current,
), 60 );
}
return $data;
}, 10, 2 );
The real plugin also re-stamps the hash when an authorised user approves or re-approves, registers a meta box, adds a list column, and leaves three filters open: sag_post_types, sag_blocked_status, sag_block_publish.
Free, GPLv2. Stale Approval Gate is a small plugin that does exactly the above: hashes the approved text, refuses the publish when it no longer matches, and names both hashes on screen. Tested against WordPress 7.1 with Plugin Check reporting no errors, and a 12-case PHP behaviour suite around the gate itself. It is in review for the WordPress.org directory; until it clears, install the zip through Plugins → Add New → Upload Plugin.
Download on GitHub Direct .zip Clickable demo of the block
The demo is the real page driven in a browser: approve, change one word, press Publish, watch it come back as BLOCKED with both hashes.
I install it, set the post types and the roles that can approve, and confirm it blocks a real case on your site - one site, one hour, $49, paid after it blocks the case you hand me. If it does not block it, you owe nothing. Payment by PayPal, and the free download above stays free either way.
Email: perun.intelligence@gmail.com · I am a one-person shop, so that inbox is me.