WP CLI说明文档

wp core is-installed

命令概述

检查 WordPress 是否已安装,通过检测标准数据库表是否存在。

适合在脚本中判断安装状态,不产生输出,仅通过退出码表示结果。

参数列表

参数 说明
--network 检查这是否是多站点安装。

常用示例

检查 WordPress 是否未安装

$ if ! wp core is-installed 2>/dev/null; then
    wp core install
fi

检查 WordPress 是否已安装并执行操作

$ if wp core is-installed 2>/dev/null; then
    wp core verify-checksums
else
    echo 'Hey Friend, you are in the wrong spot. Move in to your WordPress directory and try again.'
fi