[wp-trac] [WordPress Trac] #30854: `wp_insert_post` doesn't save revision for new published post

WordPress Trac noreply at wordpress.org
Wed Nov 17 00:54:05 UTC 2021


#30854: `wp_insert_post` doesn't save revision for new published post
-------------------------------------------------+-------------------------
 Reporter:  JamesDiGioia                         |       Owner:
                                                 |  adamsilverstein
     Type:  defect (bug)                         |      Status:  assigned
 Priority:  normal                               |   Milestone:  5.9
Component:  Revisions                            |     Version:
 Severity:  normal                               |  Resolution:
 Keywords:  has-patch has-unit-tests has-        |     Focuses:
  testing-info needs-testing needs-dev-note      |
-------------------------------------------------+-------------------------
Changes (by peterwilsoncc):

 * keywords:
     has-patch has-unit-tests has-testing-info needs-testing needs-dev-note
     commit
     => has-patch has-unit-tests has-testing-info needs-testing needs-dev-
     note


Comment:

 Since the last patch, there were a few more tests to update following the
 introduction of `wp_get_post_revisions_url()` in  [52095]. I've pushed
 some fixes to @adamsilverstein's existing branch.

 Something that occurred to me while doing so is that the existing patch
 only accounts for the post status `publish`, whereas there are other post
 statuses that are in a similar state that could require a revision:

 * `private`
 * `future`
 * `pending` and family
 * custom post statuses

 I'm worried that if the `new_to_publish` hook is used now, in the near
 future Core will need to switch to another hook/add additional `new_to_*`
 default actions.

 To account for the custom post statuses, whether a revision is saved upon
 a transition from new might best be included as property within
 `register_post_status()`. (Props @TimothyBlynJacobs for this suggestion.)

 For now, I'm removing the certainty of the `commit` keyword so some
 further consideration can be given to the ticket.

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/30854#comment:39>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list