Using wp-cli through PHP

Can I run WP-CLI https://wp-cli.org/ command through PHP script, so I can install user selected WordPress themes automatically with PHP script

Related posts

2 comments

  1. You can do something like this:

    exec('wp site list --field=url --archived=0', $output);
    
    foreach($output as $url) {
        echo $url . "n";
        echo exec("wp --url=$url plugin activate this-plugin");
    }
    

    Run it in a PHP script in your home directory.

Comments are closed.