$stylesheet, 'css' => $post === null ? '' : (string) $post->post_content]; } /** @throws RuntimeException When WordPress refuses to store the CSS. */ public function write(string $css): void { $saved = wp_update_custom_css_post($css, ['stylesheet' => get_stylesheet()]); if (is_wp_error($saved)) { throw new RuntimeException($saved->get_error_message()); } } }