[wp-trac] [WordPress Trac] #36595: can't set post_modified in wp_insert_post, becomes post_date

WordPress Trac noreply at wordpress.org
Wed Apr 20 14:14:34 UTC 2016


#36595: can't set post_modified in wp_insert_post, becomes post_date
-------------------------------+------------------------------
 Reporter:  gijsgg             |       Owner:
     Type:  defect (bug)       |      Status:  new
 Priority:  normal             |   Milestone:  Awaiting Review
Component:  Posts, Post Types  |     Version:  1.0
 Severity:  normal             |  Resolution:
 Keywords:  2nd-opinion        |     Focuses:
-------------------------------+------------------------------
Changes (by boonebgorges):

 * keywords:   => 2nd-opinion


Comment:

 > Real world case: Import posts from another CMS.

 I have run into this before myself. `wp_insert_post()` is a low-level
 function, and should allow all values to be changed. I agree that there's
 no need to support the parameter in wrapper functions, and in fact perhaps
 the parameter should be disallowed from passing through from wrapper
 functions (`unset( $params['post_modified']`).

 IMO, the only concern with making this change is that it's technically a
 compatibility break. Anyone currently passing `post_modified` to
 `wp_insert_post()` is being stymied, but on update to 4.6, the "fix" would
 make their code work, in ways that may be unexpected. This seems to me
 like a straightforward case of fixing a bug, but it's worth mentioning in
 any case.

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


More information about the wp-trac mailing list