Update Function for Post_Date via a Filter or Action ? (4 posts)

  1. BastianG
    Posted 3 years ago #


    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

  2. bcworkz
    Posted 3 years ago #

    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.

  3. BastianG
    Posted 3 years ago #

    Thanks a lot !!! Exactly what I needed to get it done :-)

  4. Driftless
    Posted 2 years ago #

    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

Topic Closed

This topic has been closed to new replies.

About this Topic