• Hi,

    I want to improve my functions.php and set a post_date according to an exif date of a specific posted picture. To get the exif date and store in a string is no problem even the conversion to a date is no problem, the challenge I am facing is whether there is a nice function which can be used in a filter/action/??? Otherwise my last chance would be to update the date via an update directly on the DB side, which I try to avoid.

    Thanks a lot – Bastian

Viewing 3 replies - 1 through 3 (of 3 total)
  • Moderator bcworkz

    (@bcworkz)

    Hook the filter ‘wp_insert_post_data’. Your function will be passed an array which in part has the date fields. You will want to change the array values for the keys ‘post_date’ and ‘post_date_gmt’. Then return the altered array.

    Thread Starter BastianG

    (@bastiang)

    Thanks a lot !!! Exactly what I needed to get it done ??

    Shameless plugin plug

    Along the same lines – I just released a plugin that does this (updates post dates to attached photo’s EXIF date) in bulk for the post type of your choosing: EXIFize My Dates

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Update Function for Post_Date via a Filter or Action ?’ is closed to new replies.