WordPress Tutorials
Running Code When a Post Is Saved with save_post
The hook fires on autosaves, on revisions, on bulk edits and on every post type. Left unguarded it runs several times for a single click, and code that updates the post from inside it runs forever.