Preserving Draft Publish Date Bug in WP 5 (not WP 4)
-
We have a plugin that creates a draft post and includes a date in the post_meta. When user clicks Publish we read the date in the post_meta and adjust the published date to match that.
In WordPress 4.X using the following actions works fine
add_action(‘auto-draft_to_publish’, array($this,’sbp_preserve_draft_date’), 10, 1);
add_action(‘draft_to_publish’, array($this,’sbp_preserve_draft_date’), 10, 1);
add_action(‘draft_to_private’, array($this,’sbp_preserve_draft_date’), 10, 1);
add_action(‘draft_to_pending’, array($this,’sbp_preserve_draft_date’), 10, 1);
add_action(‘transition_post_status’, array($this,’sbp_preserve_draft_date_save’), 10, 3);In WordPress 5.X is seems like the front end editor overwrite the date after our action sets it correctly (I see it on the front end when I click Publish it shows our date then flashes back to today’s date)
I did notice that if I open the Publish “Immediately” link and calendar appears it shows our date which is great. Then without clicking or changing date and click Publish our date is respected.
- The topic ‘Preserving Draft Publish Date Bug in WP 5 (not WP 4)’ is closed to new replies.