- // 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 ( ! is_wp_error( $r ) ) {
+ if ( get_stylesheet() === $args['stylesheet'] ) {
+ set_theme_mod( 'custom_css_post_id', $r );
+ }
+
+ // Trigger creation of a revision. This should be removed once #30854 is resolved.
+ if ( 0 === count( wp_get_post_revisions( $r ) ) ) {
+ wp_save_post_revision( $r );
+ }