<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Denis Fejza</title>
    <description>The latest articles on DEV Community by Denis Fejza (@perun_automation).</description>
    <link>https://dev.to/perun_automation</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F1851554%2Fc35aece4-6af5-466a-92c1-0fea2f879b65.png</url>
      <title>DEV Community: Denis Fejza</title>
      <link>https://dev.to/perun_automation</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/perun_automation"/>
    <language>en</language>
    <item>
      <title>The three places a WordPress publishing process skips approval</title>
      <dc:creator>Denis Fejza</dc:creator>
      <pubDate>Mon, 16 Nov 2026 00:08:15 +0000</pubDate>
      <link>https://dev.to/perun_automation/the-three-places-a-wordpress-publishing-process-skips-approval-55m1</link>
      <guid>https://dev.to/perun_automation/the-three-places-a-wordpress-publishing-process-skips-approval-55m1</guid>
      <description>&lt;h1&gt;
  
  
  The three places a WordPress publishing process skips approval (and the check that closes them)
&lt;/h1&gt;

&lt;p&gt;You approved the draft on Tuesday. It went live on Thursday with two sentences that were never in what you approved. Nobody lied, nobody broke permissions, and no log records anything unusual.&lt;/p&gt;

&lt;p&gt;This is the most common failure I see in client publishing workflows, and it is not a permissions problem. It is a &lt;strong&gt;record-keeping&lt;/strong&gt; problem: the site stores the &lt;em&gt;decision&lt;/em&gt; ("approved") but not the &lt;em&gt;thing that was decided about&lt;/em&gt;.&lt;/p&gt;

&lt;p&gt;Here is where it breaks, in order of how often it happens.&lt;/p&gt;

&lt;h2&gt;
  
  
  1. The approval lives in a different tool than the publish button
&lt;/h2&gt;

&lt;p&gt;The client says "looks good" in an email. The copy is signed off in a Google Doc comment. The Figma shows final. Then the WordPress draft gets edited once more — a price, a date, a legal line — and published.&lt;/p&gt;

&lt;p&gt;The CMS has no idea an approval ever happened, so nothing is violated from its point of view. Approval existed as a conversation, not as a constraint on the publish action. This is the agency-handoff gap: the person who approved and the person who presses Publish are not the same person, and nothing between them enforces anything.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Symptom to look for:&lt;/strong&gt; ask "show me the version that was approved" and watch how long it takes to answer. If the answer is a Slack scroll, the approval is not real.&lt;/p&gt;

&lt;h2&gt;
  
  
  2. The approval was about a version, not about the content
&lt;/h2&gt;

&lt;p&gt;Most "approval" plugins and custom statuses store a boolean-ish status: &lt;code&gt;approved = true&lt;/code&gt;. That flag says someone pressed a button at some moment. It says nothing about whether the text currently in the row is the text that was on screen at that moment.&lt;/p&gt;

&lt;p&gt;So this sequence is legal everywhere and wrong everywhere:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Editor approves.&lt;/li&gt;
&lt;li&gt;Someone fixes "just a typo" — except the typo was the price.&lt;/li&gt;
&lt;li&gt;The status still reads &lt;code&gt;approved&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;It publishes.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;The flag is honest about the past and silent about the present. That is the actual defect.&lt;/p&gt;

&lt;h2&gt;
  
  
  3. Scheduled posts and bulk edits go around the front door
&lt;/h2&gt;

&lt;p&gt;Approval checks are usually wired to the "Publish" button in the editor. They are not wired to:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;a post already scheduled, whose content is edited afterwards;&lt;/li&gt;
&lt;li&gt;bulk edit / quick edit;&lt;/li&gt;
&lt;li&gt;a REST API write from a form plugin, a Zapier-style automation, or a CSV importer;&lt;/li&gt;
&lt;li&gt;a role that can publish whose capability was granted for a different reason.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;If the check lives in the UI, it does not exist. It has to live where every write passes through.&lt;/p&gt;

&lt;h2&gt;
  
  
  What an approval has to record to be worth anything
&lt;/h2&gt;

&lt;p&gt;Three things, or it is decoration:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Who&lt;/strong&gt; approved.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;When&lt;/strong&gt;.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;A hash of the exact text&lt;/strong&gt; that was approved.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;With the third one, "has the content changed since it was approved?" becomes a comparison instead of an opinion. On WordPress, that comparison belongs in &lt;code&gt;wp_insert_post_data&lt;/code&gt; — the filter every insert and update passes through, including REST, bulk edit and scheduled transitions:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight php"&gt;&lt;code&gt;&lt;span class="nf"&gt;add_filter&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt; &lt;span class="s1"&gt;'wp_insert_post_data'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="k"&gt;function&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt; &lt;span class="nv"&gt;$data&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nv"&gt;$postarr&lt;/span&gt; &lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nv"&gt;$id&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="kt"&gt;int&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt; &lt;span class="nv"&gt;$postarr&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s1"&gt;'ID'&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;??&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt; &lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt; &lt;span class="o"&gt;!&lt;/span&gt; &lt;span class="nv"&gt;$id&lt;/span&gt; &lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="nv"&gt;$data&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;
    &lt;span class="nv"&gt;$approved&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;get_post_meta&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt; &lt;span class="nv"&gt;$id&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s1"&gt;'_approved_hash'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="kc"&gt;true&lt;/span&gt; &lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt; &lt;span class="o"&gt;!&lt;/span&gt; &lt;span class="nv"&gt;$approved&lt;/span&gt; &lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="nv"&gt;$data&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="c1"&gt;// no approval recorded: nothing to validate&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;
    &lt;span class="nv"&gt;$current&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;hash&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt; &lt;span class="s1"&gt;'sha256'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nv"&gt;$data&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s1"&gt;'post_title'&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="p"&gt;.&lt;/span&gt; &lt;span class="s2"&gt;"\n"&lt;/span&gt; &lt;span class="p"&gt;.&lt;/span&gt; &lt;span class="nv"&gt;$data&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s1"&gt;'post_content'&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt; &lt;span class="o"&gt;!&lt;/span&gt; &lt;span class="nf"&gt;hash_equals&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt; &lt;span class="nv"&gt;$approved&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nv"&gt;$current&lt;/span&gt; &lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="c1"&gt;// Block the write, or downgrade the status back to draft.&lt;/span&gt;
        &lt;span class="nv"&gt;$data&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s1"&gt;'post_status'&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s1"&gt;'draft'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;
    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="nv"&gt;$data&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;10&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;2&lt;/span&gt; &lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;code&gt;hash_equals&lt;/code&gt; rather than &lt;code&gt;===&lt;/code&gt; because it is the constant-time comparison for this job. Downgrading to draft rather than throwing an error is deliberate: it fails closed without destroying the editor's work, and it leaves the block visible in the post list.&lt;/p&gt;

&lt;p&gt;The moment you have that, the failure from section 2 is impossible: an edit after approval invalidates the approval by definition, because the hash no longer matches. Re-approving re-records the hash.&lt;/p&gt;

&lt;h2&gt;
  
  
  What this does not do
&lt;/h2&gt;

&lt;p&gt;Worth stating plainly, because the honest version is more useful than the sales version:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;It does not decide &lt;em&gt;who&lt;/em&gt; should approve. It enforces that whoever the process says approved, approved &lt;em&gt;that text&lt;/em&gt;.&lt;/li&gt;
&lt;li&gt;It does not produce a compliance audit export. It records the hash and the approver; the reporting is on you.&lt;/li&gt;
&lt;li&gt;It does not replace an editorial workflow tool if you already have one. It closes the gap those tools usually leave at the final write.&lt;/li&gt;
&lt;li&gt;Someone still has to press Approve again after a real edit. That is the point, but it is also a workflow change, and workflow changes need a conversation with the people who will hit it.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Getting it running
&lt;/h2&gt;

&lt;p&gt;The plugin is GPL-2.0 and free, no account, no upsell gate: &lt;a href="https://github.com/fejzadenis/stale-approval-gate" rel="noopener noreferrer"&gt;github.com/fejzadenis/stale-approval-gate&lt;/a&gt;. Drop the folder in &lt;code&gt;wp-content/plugins&lt;/code&gt;, activate, and the stored-hash check is active on every write. There is a &lt;a href="https://fejzadenis.github.io/leadflow/approval-gate-demo.html" rel="noopener noreferrer"&gt;clickable demo of the block happening&lt;/a&gt; — approve, edit one word, watch Publish get refused with both hashes shown — and a &lt;a href="https://fejzadenis.github.io/leadflow/wordpress-approval-workflow.html" rel="noopener noreferrer"&gt;longer write-up of the mechanism&lt;/a&gt; if you want the why before the how.&lt;/p&gt;

&lt;p&gt;If you would rather not touch the site yourself: I install and configure it, wire it to your existing roles, and hand back a short note on what now blocks what — &lt;strong&gt;$49 flat, 24 hours, PayPal&lt;/strong&gt;. Same demo link has the checkout; or reply here and I will answer the first question for free, including "your case probably is not this, here is what it actually is".&lt;/p&gt;

&lt;p&gt;One question worth asking your team this week, regardless of tooling: &lt;em&gt;if a page changed after sign-off, how would you find out?&lt;/em&gt; If the answer is "a client would tell us", the process is the gap.&lt;/p&gt;

</description>
      <category>wordpress</category>
      <category>productivity</category>
      <category>webdev</category>
      <category>security</category>
    </item>
    <item>
      <title>WordPress published a change nobody re-approved: the SHA-256 fix</title>
      <dc:creator>Denis Fejza</dc:creator>
      <pubDate>Sun, 15 Nov 2026 23:40:27 +0000</pubDate>
      <link>https://dev.to/perun_automation/wordpress-published-a-change-nobody-re-approved-the-sha-256-fix-432c</link>
      <guid>https://dev.to/perun_automation/wordpress-published-a-change-nobody-re-approved-the-sha-256-fix-432c</guid>
      <description>&lt;h1&gt;
  
  
  WordPress published a change nobody re-approved: the SHA-256 fix
&lt;/h1&gt;

&lt;p&gt;A writer drafts. A reviewer signs it off. An hour before launch, somebody fixes "just a typo" — except the typo was the price in the third paragraph. The post still says &lt;em&gt;approved&lt;/em&gt;. It still publishes.&lt;/p&gt;

&lt;p&gt;Nothing in that story is a permissions bug. The approval was a &lt;strong&gt;flag with no memory of what it approved&lt;/strong&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  What actually breaks
&lt;/h2&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;What the site has&lt;/th&gt;
&lt;th&gt;What it proves&lt;/th&gt;
&lt;th&gt;What it misses&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;A status like &lt;code&gt;approved&lt;/code&gt;, or "Editor can publish"&lt;/td&gt;
&lt;td&gt;Somebody pressed a button at some point&lt;/td&gt;
&lt;td&gt;Whether the text in the row is the text that was on screen then&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Revisions&lt;/td&gt;
&lt;td&gt;History exists after the fact&lt;/td&gt;
&lt;td&gt;Nothing stops the write; you find out from a client email&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;A staging site&lt;/td&gt;
&lt;td&gt;A copy existed somewhere&lt;/td&gt;
&lt;td&gt;Production still accepts any edit, from anyone, at any time&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;A hash of title + content + excerpt taken at approval&lt;/td&gt;
&lt;td&gt;This exact text was signed off&lt;/td&gt;
&lt;td&gt;Edits, and nothing else — see the limits below&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;The first three answer &lt;em&gt;"was this workflow followed?"&lt;/em&gt;. Only the fourth answers &lt;em&gt;"is this the text that was approved?"&lt;/em&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  Why roles and permissions do not solve it
&lt;/h2&gt;

&lt;p&gt;Giving publish rights only to a reviewer controls &lt;strong&gt;who&lt;/strong&gt; can publish. It says nothing about &lt;strong&gt;what&lt;/strong&gt;. 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.&lt;/p&gt;

&lt;p&gt;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 &lt;code&gt;wp-admin&lt;/code&gt;. If the check lives in the automation, the site is only protected for the people who use the automation.&lt;/p&gt;

&lt;h2&gt;
  
  
  The mechanism
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;On approval, store the SHA-256 of &lt;code&gt;post_title&lt;/code&gt; + &lt;code&gt;post_content&lt;/code&gt; + &lt;code&gt;post_excerpt&lt;/code&gt; together, in post meta.&lt;/li&gt;
&lt;li&gt;On every save, recompute that hash from the incoming data, &lt;strong&gt;before&lt;/strong&gt; the row is written.&lt;/li&gt;
&lt;li&gt;If the stored hash is missing, or does not equal the recomputed one, force the post back to &lt;code&gt;draft&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;Show both hashes in an admin notice, so "which version was approved" is answerable instead of arguable.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;The hook is the whole argument for this design: &lt;code&gt;wp_insert_post_data&lt;/code&gt; 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, not in admin-side validation or a JavaScript guard.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight php"&gt;&lt;code&gt;&lt;span class="c1"&gt;// Simplified excerpt - a real plugin does the bookkeeping around this.&lt;/span&gt;
&lt;span class="nf"&gt;add_filter&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt; &lt;span class="s1"&gt;'wp_insert_post_data'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="k"&gt;function&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt; &lt;span class="nv"&gt;$data&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nv"&gt;$postarr&lt;/span&gt; &lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nv"&gt;$post_id&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="kt"&gt;int&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt; &lt;span class="nv"&gt;$postarr&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s1"&gt;'ID'&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;??&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt; &lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

    &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt; &lt;span class="o"&gt;!&lt;/span&gt; &lt;span class="nv"&gt;$post_id&lt;/span&gt; &lt;span class="o"&gt;||&lt;/span&gt; &lt;span class="s1"&gt;'publish'&lt;/span&gt; &lt;span class="o"&gt;!==&lt;/span&gt; &lt;span class="nv"&gt;$data&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s1"&gt;'post_status'&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="nv"&gt;$data&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;                     &lt;span class="c1"&gt;// only a publish attempt is gated&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;

    &lt;span class="nv"&gt;$approved&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;get_post_meta&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt; &lt;span class="nv"&gt;$post_id&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s1"&gt;'_sag_approved_hash'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="kc"&gt;true&lt;/span&gt; &lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt; &lt;span class="s1"&gt;''&lt;/span&gt; &lt;span class="o"&gt;===&lt;/span&gt; &lt;span class="nv"&gt;$approved&lt;/span&gt; &lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="nv"&gt;$data&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;                     &lt;span class="c1"&gt;// never approved: not this check's business&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;

    &lt;span class="nv"&gt;$current&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;hash&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt; &lt;span class="s1"&gt;'sha256'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
        &lt;span class="nv"&gt;$data&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s1"&gt;'post_title'&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="p"&gt;.&lt;/span&gt; &lt;span class="s2"&gt;"\n"&lt;/span&gt; &lt;span class="p"&gt;.&lt;/span&gt; &lt;span class="nv"&gt;$data&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s1"&gt;'post_content'&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="p"&gt;.&lt;/span&gt; &lt;span class="s2"&gt;"\n"&lt;/span&gt; &lt;span class="p"&gt;.&lt;/span&gt; &lt;span class="nv"&gt;$data&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s1"&gt;'post_excerpt'&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;
    &lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

    &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt; &lt;span class="o"&gt;!&lt;/span&gt; &lt;span class="nf"&gt;hash_equals&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt; &lt;span class="nv"&gt;$approved&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nv"&gt;$current&lt;/span&gt; &lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="nv"&gt;$data&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s1"&gt;'post_status'&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s1"&gt;'draft'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;   &lt;span class="c1"&gt;// publish refused&lt;/span&gt;
        &lt;span class="nf"&gt;set_transient&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt; &lt;span class="s1"&gt;'sag_blocked_'&lt;/span&gt; &lt;span class="p"&gt;.&lt;/span&gt; &lt;span class="nv"&gt;$post_id&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="kt"&gt;array&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
            &lt;span class="s1"&gt;'approved'&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="nv"&gt;$approved&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
            &lt;span class="s1"&gt;'current'&lt;/span&gt;  &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="nv"&gt;$current&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
        &lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;60&lt;/span&gt; &lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;

    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="nv"&gt;$data&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;10&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;2&lt;/span&gt; &lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Two details matter more than they look:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;&lt;code&gt;hash_equals&lt;/code&gt;, not &lt;code&gt;===&lt;/code&gt;.&lt;/strong&gt; Cheap, and it keeps the comparison constant-time out of habit.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;The check only fires on a publish attempt.&lt;/strong&gt; Drafts and autosaves must stay cheap and must never be silently rewritten, or editors will (rightly) hate it.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  What it does not cover — say this out loud
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Images and custom fields.&lt;/strong&gt; The hash covers the three text fields. Swap the featured image after approval and the hash does not move.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Judgement.&lt;/strong&gt; It cannot tell a good edit from a bad one. It only says &lt;em&gt;this is not what was signed off&lt;/em&gt;.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Render-time changes.&lt;/strong&gt; A template edit, a shortcode or a plugin that rewrites output later is outside the check.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Friction.&lt;/strong&gt; It will annoy somebody exactly once per project, on the day the process changes — which is the point, and worth saying before you install it.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Try it
&lt;/h2&gt;

&lt;p&gt;I packaged this as a free GPLv2 plugin so the mechanism can be checked rather than trusted:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Source + release zip: &lt;a href="https://github.com/fejzadenis/stale-approval-gate" rel="noopener noreferrer"&gt;https://github.com/fejzadenis/stale-approval-gate&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;Clickable demo (approve → edit one word → Publish is refused, both hashes shown): &lt;a href="https://fejzadenis.github.io/leadflow/approval-gate-demo.html" rel="noopener noreferrer"&gt;https://fejzadenis.github.io/leadflow/approval-gate-demo.html&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;Longer write-up: &lt;a href="https://fejzadenis.github.io/leadflow/wordpress-approval-workflow.html" rel="noopener noreferrer"&gt;https://fejzadenis.github.io/leadflow/wordpress-approval-workflow.html&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;It hooks &lt;code&gt;wp_insert_post_data&lt;/code&gt;, stores a SHA-256 of the approved text in post meta, re-stamps on re-approval, forces &lt;code&gt;draft&lt;/code&gt; on a mismatch, and leaves three filters open (&lt;code&gt;sag_post_types&lt;/code&gt;, &lt;code&gt;sag_blocked_status&lt;/code&gt;, &lt;code&gt;sag_block_publish&lt;/code&gt;). PHP 7.4+, WordPress 6.x, no external services, nothing leaves the site.&lt;/p&gt;

&lt;p&gt;I also install and configure it for people who would rather not touch the code — that part is paid, the plugin itself is not. If you have seen this exact failure in production, I would like to hear which editor path caught you: classic, block, REST, or bulk edit.&lt;/p&gt;

</description>
      <category>wordpress</category>
      <category>php</category>
      <category>webdev</category>
      <category>tutorial</category>
    </item>
  </channel>
</rss>
