[wp-trac] [WordPress Trac] #23906: post_save callback is passed post instead of revision, breaking back-compat

WordPress Trac noreply at wordpress.org
Sat Mar 30 02:03:18 UTC 2013


#23906: post_save callback is passed post instead of revision, breaking back-compat
-----------------------------+--------------------------
 Reporter:  iandunn          |       Type:  defect (bug)
   Status:  new              |   Priority:  normal
Milestone:  Awaiting Review  |  Component:  Revisions
  Version:  trunk            |   Severity:  normal
 Keywords:                   |
-----------------------------+--------------------------
 Running the following snippet on 3.5.1 and 3.6-alpha-23875 produces
 different results, and the change can break backwards compatibility for
 plugins that have logic that targets the revision rather than the
 canonical post.

 {{{
 function print_revision_parent( $revision_id, $revision ) {
         var_dump( $revision->post_type );
         var_dump( $revision->post_parent );
         wp_die( '' );
 }
 add_action( 'save_post', 'print_revision_parent', 10, 2 );
 }}}

 In 3.5.1, the output is:
 {{{
 string 'revision' (length=8)
 int 324
 }}}

 In 3.6-alpha-23875, it's:
 {{{
 string 'post' (length=4)
 int 0
 }}}

 I wasn't able to find the changeset that caused it, but I'm assuming it's
 related to all the work around revisions for 3.6.

-- 
Ticket URL: <http://core.trac.wordpress.org/ticket/23906>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list