WordPress.org

Make WordPress Core

Changes between Version 1 and Version 2 of Ticket #46671, comment 4


Ignore:
Timestamp:
07/11/2019 09:02:06 PM (4 months ago)
Author:
SergeyBiryukov
Comment:

Legend:

Unmodified
Added
Removed
Modified
  • Ticket #46671, comment 4

    v1 v2  
    11I just spent hours trying to figure out why restoring revisions sometimes redirects to the wrong post and after debugging and pulling my hair out arrived at a conclusion that this has to be a bug in WP core.
    22
    3 Then I found this ticket (along with https://core.trac.wordpress.org/ticket/18408 which is still unresolved after 8 years and may or may not be related).
     3Then I found this ticket (along with #18408 which is still unresolved after 8 years and may or may not be related).
    44
    55In 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()`.