Tuesday, September 1, 2015

Mass update/import setting (option) in WordPress Multisite using WP-CLI

Ok, just put this shell script inside your wordpress's root:



Then run it. For example, I want to update the tadv_settings (TinyMCE Advanced) to all the blogs in my network:

/my/wordpress/root/$ ./update_setting.sh tadv_settings /path/to/my/settings.txt


The setting file look like this, settings.txt:

{"toolbar_1":"fontselect,fontsizeselect,forecolor,backcolor,bold,italic,underline,blockquote,wp_code,bullist,numlist,alignleft,aligncenter,alignright,alignjustify,link,unlink","toolbar_2":"formatselect,undo,redo,table,media,image,hr,subscript,superscript,strikethrough,outdent,indent,pastetext,removeformat,charmap,wp_more,emoticons,code,fullscreen","toolbar_3":"","toolbar_4":"","options":"advlist,contextmenu,advlink,menubar,image","plugins":"anchor,code,insertdatetime,nonbreaking,print,searchreplace,table,visualblocks,visualchars,emoticons,advlist,link,contextmenu"}