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.

Built from https://develop.svn.wordpress.org/branches/4.7@39479


git-svn-id: http://core.svn.wordpress.org/branches/4.7@39419 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Weston Ruter 2016-12-04 17:33:40 +00:00
parent e918433445
commit 8f1a4c9a56
2 changed files with 7 additions and 2 deletions

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.7-RC2-39476';
$wp_version = '4.7-RC2-39479';
/**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.