Docs

WP-CLI commands

Connect, check and disconnect a site from the command line with wp w-pencil connect, status and disconnect, and install and update W-Pencil with WP-CLI.

6 min read WordPress 6.6+ Updated 1 Dec 2026

Installing and updating

W-Pencil isn't on wordpress.org, so install it from w-pencil.cloud's address:

Terminal
$ wp plugin install https://w-pencil.cloud/download/w-pencil.zip --activate

Updating

Once it's installed, W-Pencil updates like any other plugin, from w-pencil.cloud:

Terminal
$ wp plugin update w-pencil
$ wp plugin auto-updates enable w-pencil
$ wp plugin get w-pencil --field=version

An update is offered only when w-pencil.cloud's answer carries the release key's signature, and W-Pencil downloads the zip itself and installs it only when its SHA-256 matches. Otherwise the update stops with "The W-Pencil update was refused: the downloaded file is not the one w-pencil.cloud signed." and the installed version stays. W-Pencil asks for the newest release at most every 6 hours, an hour after a failure.

Which site

WP-CLI runs W-Pencil for the site in wp-config.php, at its own address. On a network, or to act as another address, give it with --url, the address editors use:

Terminal
$ wp w-pencil status --url=https://shop.example.org

wp w-pencil connect

Connects the site to a W-Pencil account, for servers where the Connect W-Pencil button isn't handy: with a site key, or through a browser.

With a site key

--key=… takes a site key, made on the Sites page of your W-Pencil dashboard by an owner or admin of the account. It connects at once, without a browser, then prints the status below:

Terminal
$ wp w-pencil connect --key=WPK-7Q2M-K9TD-4XHB-R8WN
Success: Connected to Acme Agency: 100 edits left this month.

A key works once, for 30 minutes, and connects the site to the account it was made in. Case, spaces and missing dashes don't matter. When the key is refused, the command says why:

  • "That doesn't look like a site key. Keys look like WPK-XXXX-XXXX-XXXX-XXXX."
  • "That site key isn't right. Check it, or make a new one in your W-Pencil dashboard, under Sites."
  • "That site key has expired: keys work for 30 minutes. Make a new one in your W-Pencil dashboard, under Sites."
  • "That site key was already used. Make a new one in your W-Pencil dashboard, under Sites."
  • "Too many wrong site keys from this server. Try again in an hour."
  • "This site was connected to another account in the meantime. Ask its owner to disconnect it first."
  • "W-Pencil can't be reached from this server. Check that it can make HTTPS requests to https://w-pencil.cloud, then try the key again."

Through a browser

Without --key, the command prints an address, then waits while you press Connect in a browser:

Terminal
$ wp w-pencil connect
Open this address in a browser where you are logged in to https://example.org as an admin, and press Connect:

https://w-pencil.cloud/connect?origin=https%3A%2F%2Fexample.org&return=…

Waiting for the browser… (Ctrl+C stops waiting; the address keeps working for 10 minutes.)
Success: Connected to Acme Agency.

The browser must be logged in to the site as an administrator (the w_pencil_admin capability), because w-pencil.cloud sends it back to the site's wp-admin/admin-post.php?action=w_pencil_connect to finish. Once connected, the command prints the status below.

--wait=N is how many minutes to wait for the browser: 10 at most, and 10 if you leave it out. --wait=0 prints the address and stops:

Terminal
$ wp w-pencil connect --wait=0
…
The address works for 10 minutes. Check with: wp w-pencil status

If the wait runs out first, it says "Not connected yet. The address works for 10 minutes from when it was printed." The address still works until then.

On a sub-site of a sub-directory network, it stops with "This site shares its address with the main site of the network, so it can't be connected on its own yet." Multisite explains.

Either way, the site makes its own key pair and sends only the public half. A site key isn't kept anywhere on the site: it only tells w-pencil.cloud which account the site joins.

wp w-pencil status

Shows whether the site is connected, and its edits. When it's connected, it asks w-pencil.cloud for fresh figures first:

Terminal
$ wp w-pencil status
+------------------+----------------------------------+
| Field            | Value                            |
+------------------+----------------------------------+
| Connected        | yes                              |
| Account          | Acme Agency                      |
| Plan             | Free                             |
| Edits left       | 97 of 100                        |
| Renews           | 1 Jan 2027 00:00                 |
| Origin           | https://example.org              |
| Key fingerprint  | SHA256:6pX0… (database)          |
| Lease            | 4 of 5 left, until 1 Dec 10:42   |
| Not reported yet | 1                                |
+------------------+----------------------------------+

The rows:

  • Connected: yes, no or no (disconnected), the last for a site that was connected once.
  • Account and Plan: the account, and Free or the packs, like Pack × 2, paid yearly.
  • Edits left: the account's edits less this site's saves not reported yet, out of what the month gave, like 97 of 100. When edits added by hand take the balance past that, only the number shows. It ends in "(last known: W-Pencil was not reached)" when the cloud didn't answer.
  • Renews: when the edits come back.
  • Origin: the address the site was connected from.
  • Key fingerprint: the fingerprint of the site's key, and whether the key comes from W_PENCIL_KEY or the database.
  • Lease: the edits the site may spend before it asks again, like 4 of 5 left. The plugin and the cloud explains leases.
  • Not reported yet: saves waiting to be reported.
  • Offline: only while the cloud can't be reached, like since 1 Dec 10:42, 32 offline edits left.
  • Trial edits left: on a site that isn't connected yet.
  • Copy of: on a copy of a connected site's database, like example.org (edits here are free; disconnect with --local).
  • Local site: on a local development host, yes: edits are free, or yes, but counted (W_PENCIL_FORCE_METERING).

wp w-pencil disconnect

Disconnects the site. W-Pencil stops accepting its key at once, and the site forgets it. It asks first; --yes doesn't:

Terminal
$ wp w-pencil disconnect
Disconnect this site from W-Pencil? Its key stops working at once. [y/n] y
Success: Disconnected. This site's key no longer works.

If w-pencil.cloud can't be reached, the site still forgets the connection and warns: "Disconnected on this site, but W-Pencil couldn't be reached to stop the key. Disconnect the site in your dashboard too."

--local forgets the connection on this site only, without telling W-Pencil. Use it on a copy of the live site's database, whose live site stays connected:

Terminal
$ wp w-pencil disconnect --local --yes
Success: Disconnected on this site only. The site it was copied from stays connected.

On a site W-Pencil takes for a copy, a plain disconnect acts as --local too, and says "This site looks like a copy of example.org, so only this copy was disconnected. example.org stays connected."

On a copy, always add --local. A copy has the live site's key, so a plain disconnect that doesn't see it's a copy stops the live site's key too. The signing key and copies covers copies.

On a site that isn't connected, it says "W-Pencil is not connected." and changes nothing.

Reporting saves now

Saves are reported after editors' saves and by WP-Cron every hour. To report waiting saves and refill the allowance now, run W-Pencil's cron event:

Terminal
$ wp cron event run w_pencil_sync

Next in Reference

wp-config constants.

The three constants W-Pencil reads from wp-config.php or the environment, the settings the settings page writes and where W-Pencil keeps the rest.