WordPress.org

Make WordPress Core

Ticket #39032: 39032.4.diff

File 39032.4.diff, 688 bytes (added by westonruter, 5 years ago)
  • src/wp-includes/theme.php

    diff --git src/wp-includes/theme.php src/wp-includes/theme.php
    index cf1bb0f..29b7fd3 100644
    function wp_update_custom_css_post( $css, $args = array() ) { 
    17861786                $r = wp_update_post( wp_slash( $post_data ), true );
    17871787        } else {
    17881788                $r = wp_insert_post( wp_slash( $post_data ), true );
     1789
     1790                // Trigger creation of a revision. See #30854.
     1791                if ( ! is_wp_error( $r ) && 0 === count( wp_get_post_revisions( $r ) ) ) {
     1792                        wp_save_post_revision( $r ); // Trigger creation of a revision. See #30854.
     1793                }
    17891794        }
    17901795
    1791         if ( $r instanceof WP_Error ) {
     1796        if ( is_wp_error( $r ) ) {
    17921797                return $r;
    17931798        }
    17941799        return get_post( $r );