Changes between Initial Version and Version 1 of Ticket #46671, comment 4
- Timestamp:
- 07/10/2019 11:25:30 PM (7 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
Ticket #46671, comment 4
initial v1 5 5 In our case, we have a hook into `transition_post_status`, and in this hook, we perform a secondary query using the correct `new WP_Query()`, `have_posts()`, and `the_post()`, followed by `wp_reset_postdata()`. 6 6 7 The last post in this secondary query gets erroneously set past `wp_reset_postdata()` and then `wp_restore_post_revision()` ends up using it as a redirect, and we get redirected to the wrong post. 7 The last post in this secondary query erroneously sticks around as `$post` after `wp_reset_postdata()`. 8 9 This happens as part of `wp-includes/post.php`->`wp_restore_post_revision()`->`wp_update_post()`->`wp_insert_post()`->`wp_transition_post_status()`. The redirect ends up using this incorrect $post. 10 11 Here's the call stack: 12 [[Image(https://i.imgur.com/06mTD0X.png)]] 8 13 9 14 Is there anyone who can take a look at properly resolving this bug @SergeyBiryukov? 10 15 11 16 Thanks. 17