Confirm the WordPress Site Before Running WP-CLI
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.
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.
Related Ferkesh Knowledge Base guides
- How to Read WordPress Site Health Before Moving Hosting
- How to Map Dependencies Before Restoring a WordPress Multisite Site
Official references
Last reviewed .
شكرًا على ملاحظاتك!