我可以通过PHP脚本运行WP-CLI https://wp-cli.org/
命令吗,所以我可以使用PHP脚本自动安装用户选择的WordPress主题
As long as you can use the exec() or similar command. I use something like this to output the result of a wp-cli command:
<pre>
<?php
exec("wp --info", $result);
echo implode(PHP_EOL, $result); // join multi-line return result
?>
</pre>
Or simply:
<?php exec("wp --info");
See this answer: https://wordpress.stackexchange.com/questions/219230/utilize-wp-cli-from-inside-wordpress-not-ssh for further discussion.
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.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.