Skip to content
ferkesh.HOSTING
Ferkesh Support Center Ferkesh Knowledge Base Frequently asked questions

Confirm the WordPress Site Before Running WP-CLI

WordPress 54 次浏览 Markdown

In a shell serving several sites, the current directory is a poor way to identify the installation. WP-CLI's path selects files. The URL selects the site context and matters on Multisite. Establish both before any operational workflow.

Filesystem: Explicit --path; Site context: Explicit --url; Read-only proof: home + siteurl.

Set an explicit path

From an authorized account, compare the document root with the hosting control panel. For a synthetic staging installation, run wp --path=/srv/staging/wordpress --url=https://example.test option get home. Substitute the actual approved path and staging hostname on your own environment.

Verify application context

Read siteurl with the same arguments as a second check. Home and siteurl can legitimately differ if WordPress core lives in a subdirectory. A Multisite subsite needs its own URL or path, not merely the network's primary address. Record the outputs and confirm that they describe the site you intended.

Stop on ambiguity

If the command loads the wrong site, cannot find the config, or fails because a component is unavailable, resolve the path and runtime first. Avoid adding skip flags merely to force a production write. A successful read proves that this invocation reached the expected context. It does not make an unrelated command safe.

Official references

Last reviewed .

这对您有帮助吗?

感谢您的反馈!

仍需帮助?

如果知识库未能解答您的问题,支持团队全天候为您服务。