I have a few custom post types to define various types of content and one CPT to configure which fields should get rendered. The config CPT also defines a taxonomy so I can pick and choose with which config a CPT gets rendered.
The taxonomy term is defined by the post_title
of its CPT.
Adding a term to the taxonomy is no problem hooking into the save_post
-hook.
My problem is with changing the name of a taxonomy or deleting it. The expected behaviour is that when I change the post_title
of my taxonomy that the name of the exixtig taxonomy term gets also changed. At this time there is just a new one added.
Same with deleting the CP which defines a taxonomy.
Is there a hook that actually only fires when a post gets updated and where I can get $post_before
and $post_after
?
If not, how can I reliably check if a post gets updated?
The save_post
-hook gets fired when creating a post for the first time as well as when updating an existing post which is a bit annoying.