diff --git a/bin/noblogs.in b/bin/noblogs.in index 5ea6b39a39c91b86bb2ef857774cf3821b573f0d..c0138d26f99cbb9b135b4358994159986bfb692a 100755 --- a/bin/noblogs.in +++ b/bin/noblogs.in @@ -90,6 +90,10 @@ Known commands: wp-piwik-clear-config BLOG Clear the configuration for wp-piwik plugin. + copy-custom-css BLOG + Copies the Custom CSS config to the standard Wordpress Customizer config, + then removes the old (options). + <?php exit(1); } @@ -594,6 +598,30 @@ function do_uninstall_plugin($args){ } } +function do_copy_custom_css($args){ + foreach ($args as $arg) { + $blog = noblogs_get_blog($arg); + if (!$blog) { + echo "{$arg}: blog not found.\n"; + continue; + } + switch_to_blog($blog->blog_id); + + $custom_css = get_option('custom-css'); + + if (!$custom_css){ + $wp_css = wp_get_custom_css(); + + wp_update_custom_css_post($wp_css . "\n" . $custom_css); + + delete_option('custom-css'); + delete_option('custom_css_setting'); + } + + restore_current_blog(); + } +} + // Command-line parsing. $cmd = $argv[1]; if (!$cmd) {