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

WordPress Trac noreply at wordpress.org
Wed Nov 10 03:31:03 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 adamsilverstein):

 * milestone:  Future Release => 5.9


Comment:

 @peterwilsoncc this change is mainly to fix a bug for posts created
 programmatically, for example with a CLI script.

 This is a bug fix, not a feature so... we can continue to consider it for
 5.9, right?

 > At the moment, revisions can be disable with remove_action(
 'post_updated', 'wp_save_post_revision', 10, 1 );, with this change this
 will no longer be effective.

 Do we recommend that approach in our handbook, or that common practice in
 the wild?

 To disable revisions entirely, I would recommend:

 `add_filter( 'wp_revisions_to_keep', '__return_zero' );`

 Or set the `WP_POST_REVISIONS` constant to 0.

 This approach will continue to work after this change, we can document
 that in the dev note.

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


More information about the wp-trac mailing list