Monday, June 20, 2016

Get activated theme on every site in WordPress Multisite using wp-cli

You can use this:

1. Install wp-cli.

2. Create a bash script ( with the following content

#! /bin/bash

for url in $(wp site list --field=url --path=/path/to/your/wordpress/root)
        theme=$(wp option get template --url="$url" --path=/path/to/your/wordpress/root)
        echo "$url,$theme"

3. Make script executable:

$ sudo chmod +x

4. Run the script:

$ sudo -u www-data ./ > blog_theme_list.csv

Notes: Sometimes, the script return no result because of caches or WordPress db connection limitation.