Support » Fixing WordPress » Rewrite fields after editing field values

  • 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 2 months, 3 weeks ago by Jan Dembowski.
Viewing 1 replies (of 1 total)
  • Moderator 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)
  • You must be logged in to reply to this topic.