# WordPress reference

Reference for running WordPress on TurboStack: where the files live, the command-line tool, and the scheduled jobs. For setup see [Deploy WordPress on TurboStack](deploy.md); for tuning see [WordPress best practices](best-practices.md).

## File layout

Everything lives under your system user's home directory. `~` is that home directory (for example `/var/www/prod/`). `~/public_html` is both the WordPress root and the web document root.

| Path | What it is |
| --- | --- |
| `~/public_html/` | WordPress root and web document root (the served files) |
| `~/public_html/wp-admin/` | Admin interface |
| `~/public_html/wp-content/` | Themes, plugins and uploads |
| `~/public_html/wp-includes/` | Core functions |
| `~/public_html/wp-config.php` | Site configuration |
| `~/nginx/` | Custom Nginx configuration |

For ownership and permissions, see [Application file layout and permissions](../index.md#file-layout-and-permissions).

## Command-line reference

WordPress ships a command-line interface (CLI) called WP-CLI. Run its commands with the `wp` tool from `~/public_html`. The common command groups are below.

| Command | What it does |
| --- | --- |
| `wp core download` / `install` / `update` / `version` / `check-update` | Download, install, update or report the WordPress core |
| `wp plugin install` / `activate` / `deactivate` / `delete` / `update` / `list` | Manage plugins |
| `wp theme install` / `activate` / `delete` / `update` / `list` | Manage themes |
| `wp user create` / `delete` / `list` / `update` / `get` | Manage users |
| `wp db export` / `import` / `reset` / `check` / `optimize` | Manage the database |
| `wp media import` / `regenerate` | Import media or regenerate thumbnails |
| `wp option get` / `update` / `delete` | Read or change a site option |
| `wp config create` / `set` / `get` | Manage `wp-config.php` values |
| `wp cron event list` / `run` / `delete` | Inspect or run scheduled events |
| `wp cache flush` | Flush the object cache |
| `wp transient get` / `set` / `delete` | Manage transients |
| `wp search-replace <old> <new>` | Replace strings across the database (add `--dry-run` first) |
| `wp site url` | Show or set site URLs |
| `wp rewrite flush` | Flush permalink rewrite rules |
| `wp eval` / `wp shell` | Run PHP code or open an interactive shell |

Caching runs in front of WordPress with Redis and Varnish. Page-cache plugins include W3 Total Cache, WP Super Cache and LiteSpeed Cache. Clear the platform caches with the TurboStack command-line tool (`tscli`):

> [!WARNING]
> `tscli redis clear` and `tscli varnish clear` flush the whole cache. Traffic hits the origin until the cache refills. See [TurboStack CLI](../../api/cli.md).

## Cron

WordPress schedules tasks with `wp-cron`, which runs only on page visits. On quiet sites jobs fire late; on busy sites they fire too often and waste PHP processes. For reliability, disable the web trigger and run a real cron that calls WP-CLI.

1. Disable the web trigger in `wp-config.php`:
   ```php
   define( 'DISABLE_WP_CRON', true );
   ```
2. Add a cron entry (every 5 minutes) that runs the due events:
   ```bash
   */5 * * * * wp cron event run --due-now --path=/var/www/prod/public_html > /dev/null 2>&1
   ```

For the multisite variant and full guidance, see [WordPress best practices](best-practices.md#run-a-real-cron-job). To run a real cron as a persistent user service, see [How to manage user system services](../../technologies/system-services/manage-user-services.md).

## Related

- [Deploy WordPress on TurboStack](deploy.md)
- [WordPress best practices](best-practices.md)
- [Troubleshooting WordPress](troubleshooting.md)
- [Application file layout and permissions](../index.md#file-layout-and-permissions)
- [How to manage user system services](../../technologies/system-services/manage-user-services.md)
