Make WordPress Core

Opened 8 years ago

Closed 8 years ago

Last modified 8 years ago

#39032 closed defect (bug) (fixed)

When saving Custom CSS, preserve the original version in the revision history.

Reported by: georgestephanis's profile georgestephanis Owned by: westonruter's profile westonruter
Milestone: 4.7 Priority: normal
Severity: major Version: 4.7
Component: Customize Keywords: has-patch has-unit-tests commit dev-reviewed
Focuses: Cc:

Description

Related: #30854

When saving CSS revisions via wp_update_custom_css_post() the initial css is lost, and only subsequent updates are versioned in revisions in the database.

To avoid data loss, @adamsilverstein demonstrated that calling wp_update_post( $post ) immediately after insertion can create the revision correctly as a stopgap measure here: https://core.trac.wordpress.org/attachment/ticket/30854/test_wp_first_revision_is_not_lost.2.diff

This is only a targeted fix, and will not preserve the first revision of posts managed via the new WP REST API endpoints.

Attachments (6)

39032.diff (449 bytes) - added by georgestephanis 8 years ago.
39032.2.diff (456 bytes) - added by georgestephanis 8 years ago.
39032.3.diff (504 bytes) - added by georgestephanis 8 years ago.
39032.4.diff (688 bytes) - added by westonruter 8 years ago.
39032.with-tests.diff (1.5 KB) - added by georgestephanis 8 years ago.
39032.5.diff (2.0 KB) - added by westonruter 8 years ago.

Download all attachments as: .zip

Change History (12)

#1 @westonruter
8 years ago

  • Milestone changed from Awaiting Review to 4.7
  • Owner set to georgestephanis
  • Status changed from new to assigned

The scope of the patch makes sense for 4.7, except we should use wp_save_post_revision().

Last edited 8 years ago by westonruter (previous) (diff)

#2 @westonruter
8 years ago

  • Owner changed from georgestephanis to westonruter
  • Status changed from assigned to accepted

@westonruter
8 years ago

@westonruter
8 years ago

#3 @westonruter
8 years ago

  • Keywords has-unit-tests commit dev-feedback added

#4 @helen
8 years ago

  • Keywords dev-reviewed added; dev-feedback removed

#5 @westonruter
8 years ago

  • Resolution set to fixed
  • Status changed from accepted to closed

In 39477:

Customize: Ensure a custom_css post insertion gets an initial post revision.

Props georgestephanis, westonruter.
See #30854, #38672, #35395.
Fixes #39032.

#6 @westonruter
8 years ago

In 39479:

Customize: Ensure a custom_css post insertion gets an initial post revision.

Merges [39477] onto 4.7 branch.
Props georgestephanis, westonruter.
Fixes #39032 for 4.7.

Note: See TracTickets for help on using tickets.