Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Author Ella Van Durpe

    (@ellatrix)

    No need to do that, wp_update_post() does that for you.
    Are you sure this doesn’t work for you?

    Thread Starter Henry Wright

    (@henrywright)

    I see wp_update_post() calls wp_insert_post() and in that function $post_modified and $post_modified_gmt get assigned the current time. When I was testing I decided to check the record in the db and for some reason – the post modified date wasn’t saved. I had to force it inwp_fee_post to get it to work.

    For the modified date to get assigned a new current date and time, this condition in wp_insert_post has to be true

    if ( $update || '0000-00-00 00:00:00' == $post_date )

    else it gets assigned the post creation date (which seemed to be what was happening).

    All I can think of is my updated post wasn’t seen as an ‘update’ for some reason. It could well be my dev install playing games.

    I’ll let you know once I investigate more.

    Plugin Author Ella Van Durpe

    (@ellatrix)

    Maybe you didn’t modify anything? I’d have to look at it.

    Thread Starter Henry Wright

    (@henrywright)

    The modifications went through, I checked that too. It was just a text update to the content.

Viewing 4 replies - 1 through 4 (of 4 total)

The topic ‘Save the post modified date’ is closed to new replies.