# WordPress apps

> Deploy WordPress from Git with atomic releases and rollback: classic or Bedrock, a generated wp-config.php and salts, shared uploads, real cron and WP-CLI.

URL: https://cipi.sh/docs/wordpress-apps · Last updated: 2026-12-01 · Section: Apps

A WordPress app deploys a WordPress kept in Git the way a Laravel app deploys: a new release beside the live one, one switch, rollback. The uploads and the configuration live outside the releases, so a deploy never touches them.

A WordPress app from Git:

```console
$ sudo cipi app create --wordpress --user=blog --domain=blog.example.com --repository=git@github.com:acme/blog.git
→ Creating 'blog' (wordpress)...
✓ User   ✓ Directories   ✓ Deploy key
✓ Deploy key can read acme/blog (main)
✓ Database blog (MariaDB)
✓ shared/: .env, wp-config.php, wp-content/uploads
✓ PHP-FPM 8.5 (+ Git webhook)   ✓ Nginx → blog.example.com
✓ Deploy trigger + WordPress cron   ✓ Deployer   ✓ Permissions

  Runtime:    WordPress — PHP-FPM, zero-downtime releases
  Docroot:    /home/blog/current  (the release being served)
  Database    blog / kT4…  (MariaDB)
  Shared      ~/shared/.env — DB, salts, WP_HOME; uploads in ~/shared/wp-content/uploads
  Next: cipi deploy blog   then cipi ssl install blog
```

## WordPress app or custom app?

| | WordPress app (`--wordpress`) | Custom app (`--custom`) |
| --- | --- | --- |
| The code | In Git: core, themes and plugins, committed or required with Composer | Uploaded over SFTP, or pulled into `~/htdocs` |
| Deploy | Zero-downtime releases with rollback | In place |
| Plugins and updates | In Git, then a deploy. wp-admin does not install or update | From wp-admin, as usual |
| Database, salts, `wp-config.php` | Created and written for you | A database on request; the configuration is yours |
| For | Sites built by developers, with a repository and reviews | A WordPress run from its dashboard |

Both are fine. A site whose plugins are installed from wp-admin is a [custom app](https://cipi.sh/docs/custom-apps): a release is replaced whole at the next deploy, and what the dashboard added would be gone with it.

## Create one

```bash
# WordPress at the root of the repository
$ sudo cipi app create --wordpress --user=blog --domain=blog.example.com \
    --repository=git@github.com:you/blog.git

# Bedrock (roots.io): served from web/, WordPress in web/wp
$ sudo cipi app create --wordpress --user=shop --domain=shop.example.com \
    --repository=git@github.com:you/shop.git --docroot=web

# A theme built with Vite, on PHP 8.4
$ sudo cipi app create --wordpress --user=mag --domain=mag.example.com \
    --repository=git@github.com:you/mag.git --php=8.4 \
    --node-build='npm ci && npm run build'
```

| Flag | Meaning | Default |
| --- | --- | --- |
| `--wordpress` | The app type. Also `--framework=wordpress`, or *WordPress* in the wizard | |
| `--repository` | Git URL over SSH. Required | asked |
| `--docroot=web` | A [Bedrock](https://cipi.sh/docs/wordpress-apps#repository) project | the repository's root |
| `--db=NAME` | The database's name. `--no-db` makes none | the app's name |
| `--node-build` | Asset build run in every deploy | none |
| `--php`, `--branch`, `--env` | As for [every app](https://cipi.sh/docs/create-app#flags) | |

The database is on MySQL or MariaDB, the engines WordPress runs on: `--engine=pgsql` is refused.

## What the repository holds

| Layout | In Git | Not in Git |
| --- | --- | --- |
| **Classic** | WordPress itself (`index.php`, `wp-settings.php`, `wp-admin/`, `wp-includes/`), `wp-content/themes`, `wp-content/plugins` | `wp-config.php`, `wp-content/uploads` |
| **Bedrock** | `composer.json` and `composer.lock`, `config/`, `web/app/themes`, your own plugins | `.env`, `web/wp` and the plugins Composer installs, `web/app/uploads` |

A `wp-config.php` committed to a classic repository is harmless: Cipi's own takes its place in every release. A `composer.json` at the root is installed on every deploy, so plugins from [wpackagist](https://wpackagist.org) work in a classic layout too.

Before a release goes live, the deploy checks that it has a WordPress to serve (`index.php` and `wp-settings.php`). A repository that holds only a theme stops there, with the site as it was.

## Where things live

```text
/home/blog/
├── current -> releases/12        # what Nginx serves
├── releases/11/ 12/              # one folder per deploy
└── shared/
    ├── .env                      # database, salts, WP_HOME…
    ├── wp-config.php             # reads that .env (classic layout)
    └── wp-content/uploads/       # the media library
```

Each release gets links to the three shared entries. Bedrock shares `.env` and `web/app/uploads` and reads the `.env` itself.

## Configuration

Everything WordPress is told lives in `~/shared/.env`. Cipi writes it when the app is created, so the first deploy shows WordPress's own installer with nothing left to configure. Change it with `sudo cipi app env blog` or from the panel's editor; it applies to the next request.

| Variable | Value |
| --- | --- |
| `DB_NAME`, `DB_USER`, `DB_PASSWORD`, `DB_HOST`, `DB_PREFIX` | The database made with the app |
| `AUTH_KEY` … `NONCE_SALT` | The eight keys and salts, generated |
| `WP_HOME`, `WP_SITEURL` | `https://` and the app's domain (`/wp` added for Bedrock). They follow `sudo cipi app edit blog --domain=…` |
| `WP_ENVIRONMENT_TYPE` | From `--env`: `production`, `staging`, `development` or `local` |
| `DISALLOW_FILE_MODS`, `AUTOMATIC_UPDATER_DISABLED` | `true`: the code comes from Git |
| `DISABLE_WP_CRON` | `true`: [cron](https://cipi.sh/docs/wordpress-apps#cron) runs from the crontab |
| `WP_DEBUG`, `WP_DEBUG_LOG`, `WP_DEBUG_DISPLAY` | `false`: errors are neither shown to visitors nor written to `debug.log`. To look into a problem set the first two to `true` and leave `WP_DEBUG_DISPLAY` off |
| `CIPI_APP_USER`, `CIPI_ENV`, `CIPI_PHP_VERSION`, `CIPI_DEPLOY_BRANCH` | What Cipi knows about the app, for your own code |
| `WP_MEMORY_LIMIT`, `FORCE_SSL_ADMIN`, `WP_CACHE` | Yours to set |

Constants that are not in the list go between the two comments at the end of `~/shared/wp-config.php` (*Add any custom values…*).

> [!WARNING]
> With `DISALLOW_FILE_MODS=true`, wp-admin hides the plugin and theme installers and the update buttons. That is the point: add a plugin to the repository (or to `composer.json`) and deploy.

## Deploy

```bash
$ sudo cipi deploy blog
$ sudo cipi deploy blog --rollback
```

1. **Clone** — releases/13
   The commit of the branch, in a folder of its own. The live release is not touched.
2. **Shared** — .env, uploads
   `wp-config.php` (or Bedrock's `.env`) and the uploads folder are linked in.
3. **Composer** — when there is a composer.json
   `composer install --no-dev`. Nothing for a WordPress committed whole.
4. **Assets** — --node-build
   The build command of the app, if it has one.
5. **Check** — index.php, wp-settings.php
   A release without a WordPress to serve stops here.
6. **Switch** — current → releases/13
   One step. A request is answered by the old release or by the new one, never by half of each.

Pushes deploy by themselves: the webhook is Cipi's own, with nothing to install in WordPress ([auto-deploy](https://cipi.sh/docs/auto-deploy)). Keep releases, the build's time limit and the database snapshot before a deploy are in `sudo cipi app deploy-config blog`.

A rollback moves the code back. The database is not part of a release: for a deploy that changes it, turn on the [snapshot before deploy](https://cipi.sh/docs/safe-deploy).

## WP-CLI

```bash
$ sudo cipi package install wp-cli
$ sudo su - blog
$ wp plugin list
$ wp search-replace 'http://old.example.com' 'https://blog.example.com' --dry-run
```

WP-CLI on the app's own PHP:

```console
$ sudo cipi package install wp-cli
→ Downloading wp-cli-3.0.0.phar...
✓ wp-cli 3.0.0 installed — wp available
$ sudo su - blog
$ wp option get siteurl
https://blog.example.com
$ wp --info | grep 'PHP binary'
PHP binary:    /usr/bin/php8.5
$ wp cache flush
Success: The cache was flushed.
```

As the app's user, `wp` works on the live release from any folder, on the PHP version the app runs on. After a deploy it is on the new release.

## Cron

WordPress's scheduled events run every minute from the app's crontab (`wp-cron.php`, on the app's PHP), not when a visitor happens to load a page. Scheduled posts go out on time on a site with no traffic.

## Caching

| Layer | Command |
| --- | --- |
| Pages, for anonymous visitors | [`sudo cipi cache blog on`](https://cipi.sh/docs/page-cache) |
| Objects, in a Valkey of the app's own | `sudo cipi cache blog object on` writes the `WP_REDIS_*` lines into `~/shared/wp-config.php` (classic layout). On Bedrock, add them to `config/application.php` |

Step by step: [caching WordPress with Cipi](https://cipi.sh/guides/wordpress-cache).

## What Nginx does

| | |
| --- | --- |
| Permalinks | Every path that is not a file goes to `index.php` |
| Uploads | No PHP runs from the uploads folder, classic or Bedrock |
| `robots.txt` | WordPress's own answer when the repository has no file |
| During a deploy | The path of the release is resolved per request (`$realpath_root`), so OPcache never mixes two releases |

## Common problems

| Problem | Fix |
| --- | --- |
| The deploy stops at *wp-settings.php not found* | The repository has no WordPress core. Commit it, or require it with Composer (Bedrock does) |
| *Error establishing a database connection* | Check `DB_*` in `sudo cipi app env blog`. A new password: `sudo cipi db password blog`, then put it in the `.env` |
| A plugin installed from wp-admin is missing | It was added to a release that is gone. Add it to the repository and deploy |
| Images are missing after moving the site | Copy the old `wp-content/uploads` into `~/shared/wp-content/uploads` (as the app's user) |
| Redirect loop behind Cloudflare | Use *Full (strict)* on Cloudflare and install a certificate on the app: [the guide](https://cipi.sh/guides/cloudflare-proxy-ssl-wildcard) |

## Questions

| Question | Answer |
| --- | --- |
| Can I update WordPress from the dashboard? | Not in this app type: updates come from Git. For a WordPress run from its dashboard, create a [custom app](https://cipi.sh/docs/custom-apps). |
| Does it work with WooCommerce? | Yes. Orders are in the database and uploads in `shared/`: neither is touched by a deploy. See [WooCommerce on a VPS](https://cipi.sh/guides/woocommerce-vps). |
| Multisite? | Yes: add the `MULTISITE` constants to `~/shared/wp-config.php`, and for subdomains a [wildcard alias](https://cipi.sh/docs/wildcard-domains). |
| How do I move an existing site in? | Put its code in a repository, create the app, import the database (`wp db import`) and copy the uploads into `shared/`. [The guide](https://cipi.sh/guides/wordpress-git-zero-downtime) walks through it. |
| Is it backed up? | `shared/` (uploads, `.env`) and the database are in [backups](https://cipi.sh/docs/backups). The code comes back from Git. |
| Can a custom app become a WordPress app? | Not by a switch. Create the new app next to it and move the database and the uploads; the guide above has the steps. |

---

Index of every page: https://cipi.sh/llms.txt · Everything in one file: https://cipi.sh/llms-full.txt · Source: https://github.com/cipi-sh/cipi (MIT)
