How it works
How a linked site is laid out, why wp-load.php is a copy, how a switch reloads PHP, and what wpcore never touches.
A linked site
/var/www/
├── wp-cores/ shared, read-only
│ ├── 6.7/
│ └── 6.8/
│ ├── wp-admin/ wp-includes/
│ ├── wp-load.php the dispatcher
│ └── index.php, wp-login.php, …
└── local.spellbook.test/
├── wp-admin → ../wp-cores/6.8/wp-admin
├── wp-includes → ../wp-cores/6.8/wp-includes
├── index.php → ../wp-cores/6.8/index.php
├── wp-load.php a real copy
├── wp-config.php the site's own
└── wp-content/ the site's own
| In the site | What it is |
|---|---|
wp-admin, wp-includes |
links to the version's folders |
root *.php files |
links to the version's files |
wp-load.php |
a real copy, so WordPress's root is the site |
wp-content/, wp-config.php |
the site's own, never shared or touched |
Why wp-load.php is a copy
WordPress finds wp-config.php and wp-content relative to wp-load.php. A
link would make every site look in the core's folder, so each site gets a copy
of its own.
Some tools resolve links before they include wp-load.php and end up in the
cores folder anyway. For them, each core has a small dispatcher as its
wp-load.php: it finds the site from the web server's document root, the
working directory (WP-CLI's --path), or the call stack, and hands over to
that site's own copy.
A switch
sudo wpcore switch local.spellbook.test 6.7 points the site's links at the
6.7 core and reloads PHP-FPM or Apache. OPcache caches compiled files by their
real path, and the reload makes it drop what it cached for the old version.
Run the database update WordPress asks for afterwards:
wpcore wp local.spellbook.test core update-db
What wpcore never does
- It never changes a site's
wp-content,wp-config.php, or any file it did not make. - It never removes a core a site still uses:
remove-corerefuses.