---
title: "Discussion on \"A Hook That Fires Twice — and How Not to Trigger an Infinite Loop When Saving a Post\" | Hashnode"
description: "Discussion on \"A Hook That Fires Twice — and How Not to Trigger an Infinite Loop When Saving a Post\". The Problem\nA typical case: a developer hooks logic onto save_post — update a counter, sync an external service, recalculate something based on the post's fields. The code runs... and immediately runs"
url: "https://hashnode.com/posts/a-hook-that-fires-twice-and-how-not-to-trigger-an-infinite-loop-when-saving-a-post/6ab2ebd909415cde7be9af70"
---

[Feed](https://hashnode.com/feed) /

Discussion

# [A Hook That Fires Twice — and How Not to Trigger an Infinite Loop When Saving a Post](https://4wp.hashnode.dev/a-hook-that-fires-twice-and-how-not-to-trigger-an-infinite-loop-when-saving-a-post?utm_source=hashnode&utm_medium=feed)

The Problem A typical case: a developer hooks logic onto save\_post — update a counter, sync an external service, recalculate something based on the post's fields. The code runs... and immediately runs

Sep 22 · 6 min read · 4wp.hashnode.dev  
Read the article

## Written by

[Anatoliy Dovgun](https://hashnode.com/@adogun)

@adogun

  
[View profile](https://hashnode.com/@adogun)

WordPress, WordPress development, WordPress design

## Responses

Markdown supported · ⌘↵ to post

No responses yet.
