[wp-trac] [WordPress Trac] #44577: After enabling revisions for post type, takes 2 additional revisions to show metabox on old posts.

WordPress Trac noreply at wordpress.org
Fri Apr 30 18:23:46 UTC 2021


#44577: After enabling revisions for post type, takes 2 additional revisions to
show metabox on old posts.
--------------------------+-------------------------
 Reporter:  megabyterose  |       Owner:  (none)
     Type:  defect (bug)  |      Status:  closed
 Priority:  normal        |   Milestone:
Component:  Revisions     |     Version:  4.9.7
 Severity:  normal        |  Resolution:  worksforme
 Keywords:                |     Focuses:
--------------------------+-------------------------
Changes (by adamsilverstein):

 * status:  new => closed
 * resolution:   => worksforme
 * milestone:  Awaiting Review =>


Comment:

 Hi @megabyterose thanks for the report,

 This is actually expected behavior based on the current code. When you
 start a new post with revisions enabled you will get that initial
 revision/autodraft that counts as one. If you compare the two posts before
 making changes, there will already be two saved entries for the post where
 revisions are enabled for the type, while the post where revisions were
 not enabled will not have this stored revision, only the single saved
 entry. Now when you edit both posts, the one with revisions enabled
 initially will always have one additional revision. As pointed out
 elsewhere, you need to have more than one version for the UI to show.

 Essentially until revisions are enabled for a post type, none will be
 saved. Once you enable it, it will take two saves for there to be a valid
 way to display the revisions screen (only one revision will match the
 current post, so nothing will show as "changed").

 > Ones created prior to supporting revisions end up needing 3 revisions to
 display the metabox - the original, then the 2 after support is added
 (related to ticket 42500).

 Actually you still need 2, its just that the initial revision that is
 usually created when you start a post is not created, so you only have 1!

 Given the fact that this is an edge case situation, I don't feel it
 justifies changing the code or trying to resolve directly. One possible
 improvement though would be documenting the requirements more clearly in
 the handbook where enabling revisions is explained
 (https://developer.wordpress.org/plugins/post-types/registering-custom-
 post-types/). If you want to help work on a change there I am happy to
 work on this.

 Closing this ticket as "works for me" for now since this is expected
 behavior, please feel free to re-open if I have missed something.

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


More information about the wp-trac mailing list