• A newbie question. We have several editors on our site, with different skills. I need a way to check and re-edit some values entered into some fields (eg convert date to standard date format) when a new post is published. Where and what are the necessary hooks to get a call to my php checking and correcting some input of my editors? Thanks a lot in advance!

    • This topic was modified 6 years, 2 months ago by Jan Dembowski.
Viewing 1 replies (of 1 total)
  • Moderator bcworkz

    (@bcworkz)

    You have PHP code to auto-correct erroneous input? It depends on which fields need to be checked. For fields belonging to the post object, use the “wp_insert_post_data” filter. For fields stored as meta data, there is no pre-insertion filter like there is for posts. You can use the “updated_postmeta” action to check the added values and if necessary re-update with the corrected data. When you re-update data, be sure to remove your callback from the call stack or you will create an infinite loop condition.

Viewing 1 replies (of 1 total)

The topic ‘Rewrite fields after editing field values’ is closed to new replies.