WordPress.org

Forums

Gravity Forms - Update Post
[resolved] Publishdate gets reset when post is updated (5 posts)

  1. newzoo
    Member
    Posted 1 year ago #

    Hi there,

    Whenever a post gets updated, the publishdate of that particular posts gets updated. Is there anyway to bypass this action? i want to be able to update a post without changing the published date...

    http://wordpress.org/plugins/gravity-forms-update-post/

  2. Timidyo
    Member
    Posted 1 year ago #

    I have the same issue. Does anyone know how the original publish date can be preserved? Thanks in advance!

  3. Matt Brett
    Member
    Posted 1 year ago #

    Ran into this issue myself, and was able to figure it out.

    Look for the following, which is at line 266 in the current version.

    $post_data['post_type'] = $this->post['object']['post_type'];

    That retains the post_type when the post is edited. There are others similar issues, where the author can change to the user who edited it, and the comment status can be changed to closed. Here's what I added to prevent all of the above from happening...

    $post_data['post_author'] = $this->post['object']['post_author'];
    $post_data['comment_status'] = $this->post['object']['comment_status'];
    $post_data['post_date'] = $this->post['object']['post_date'];
    $post_data['post_date_gmt'] = $this->post['object']['post_date_gmt'];
  4. Timidyo
    Member
    Posted 1 year ago #

    Sweet! Thanks so much, Matt!

  5. newzoo
    Member
    Posted 1 year ago #

    Superb! that did the trick! thank you Matt

Topic Closed

This topic has been closed to new replies.

About this Plugin

  • Gravity Forms - Update Post
  • Frequently Asked Questions
  • Support Threads
  • Reviews

About this Topic

Tags

No tags yet.