[wp-trac] [WordPress Trac] #44540: Revision restoring redirect issue when using custom wp_query inside shortcodes

WordPress Trac noreply at wordpress.org
Sat Jul 7 10:43:11 UTC 2018


#44540: Revision restoring redirect issue when using custom wp_query inside
shortcodes
--------------------------+-----------------------------
 Reporter:  vendetta90    |      Owner:  (none)
     Type:  defect (bug)  |     Status:  assigned
 Priority:  normal        |  Milestone:  Awaiting Review
Component:  Revisions     |    Version:  4.9.7
 Severity:  normal        |   Keywords:
  Focuses:                |
--------------------------+-----------------------------
 Using a custom WP_Query inside page content shortcodes leads to weird
 "revisions restoring" behavior which is redirecting to improper page id.
 However the page content is restored correctly. Have found this lines 55,
 56 in revision.php


 {{{
 wp_restore_post_revision( $revision->ID );
 $redirect = add_query_arg( array( 'message' => 5, 'revision' =>
 $revision->ID ), get_edit_post_link( $post->ID, 'url' ) )
 }}}

 While wp_restore_post_revision( $revision->ID ) returns a correct post_id,
 the redirect is made to get_edit_post_link( $post->ID, 'url' ) and
 $post->ID may be broken by custom wp_query loop. Why not using
 wp_restore_post_revision( $revision->ID ) returned result to perform a
 correct redirect?

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/44540>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list