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

WordPress Trac noreply at wordpress.org
Mon Dec 29 01:37:09 UTC 2014


#30854: `wp_insert_post` doesn't save revision for new published post
--------------------------+------------------------------
 Reporter:  JamesDiGioia  |       Owner:  adamsilverstein
     Type:  defect (bug)  |      Status:  assigned
 Priority:  normal        |   Milestone:  Awaiting Review
Component:  Revisions     |     Version:  trunk
 Severity:  normal        |  Resolution:
 Keywords:  needs-patch   |     Focuses:
--------------------------+------------------------------
Changes (by adamsilverstein):

 * keywords:   => needs-patch
 * owner:   => adamsilverstein
 * status:  new => assigned


Comment:

 Hey JamesDiGioia!

 Thanks for the bug report. Oh thats a problem, I can see why you aren't
 getting an initial revision for your posts! We didn't think about posts
 created this way when creating the original post revision.

 I'm not sure moving save_post is good, I think that action fires twice on
 publish.  We could try the change (want to try writing a patch for that?)
 and run our tests, I'd still worry about unintended consequences. Open to
 other ideas...

 In the mean time, a workaround worth trying would be:

 * use `wp_insert_post` to create an initial post and get the the post ID
 * use `wp_update_post` to insert your post data

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


More information about the wp-trac mailing list