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

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

Built from https://develop.svn.wordpress.org/trunk@39477


git-svn-id: http://core.svn.wordpress.org/trunk@39417 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Weston Ruter 2016-12-04 17:31:33 +00:00
parent 27475953bc
commit 0a31089bf6
4 changed files with 8 additions and 3 deletions

File diff suppressed because one or more lines are too long

View File

@ -1786,9 +1786,14 @@ function wp_update_custom_css_post( $css, $args = array() ) {
$r = wp_update_post( wp_slash( $post_data ), true );
} else {
$r = wp_insert_post( wp_slash( $post_data ), true );
// Trigger creation of a revision. This should be removed once #30854 is resolved.
if ( ! is_wp_error( $r ) && 0 === count( wp_get_post_revisions( $r ) ) ) {
wp_save_post_revision( $r );
}
}
if ( $r instanceof WP_Error ) {
if ( is_wp_error( $r ) ) {
return $r;
}
return get_post( $r );

View File

@ -4,7 +4,7 @@
*
* @global string $wp_version
*/
$wp_version = '4.8-alpha-39475';
$wp_version = '4.8-alpha-39477';
/**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.