Docs

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.

5 min read WordPress 6.6+ Updated 1 Dec 2026

Constants or environment variables

W-Pencil reads three settings that belong with the server rather than in the database. Each is a constant in wp-config.php, or, when no constant of that name is defined, an environment variable of the same name, so a hosting panel, Docker or a .env loader can set it. A constant wins over the environment.

W_PENCIL_KEY

The site's signing key, so the private half never enters the database:

PHP
// 32 random bytes, base64: php -r 'echo base64_encode(random_bytes(32)), "\n";'
define( 'W_PENCIL_KEY', getenv( 'MY_SECRETS_W_PENCIL_KEY' ) );
  • The value is 32 random bytes in base64, 44 characters. Make it once, and keep it with your other secrets.
  • Set it before connecting. The site makes its Ed25519 key pair from it, and connecting sends w-pencil.cloud the public half only.
  • Check it took: W-Pencil › Account says Key kept in "wp-config.php (W_PENCIL_KEY)", wp w-pencil status adds "(W_PENCIL_KEY)" after the key's fingerprint, and Site Health says "W-Pencil's key is in wp-config.php". A value that isn't 32 bytes in base64 is ignored, Site Health says "W_PENCIL_KEY is not a key", and the key is kept in the database instead.
  • Adding it to a connected site, or changing it, disconnects the site the next time it talks to W-Pencil, which no longer recognises its signature. Connect again afterwards.

Without it, the signing key is kept in the w_pencil_connection option, which isn't loaded on every page. The signing key and copies says when to use it, and how to give each environment its own.

W_PENCIL_FORCE_METERING

PHP
define( 'W_PENCIL_FORCE_METERING', true );

Counts edits on a local development host as if it were a live site, to try the credit chip and the out-of-credits panel. The edits come out of the connected account's. false, 0, no, off and an empty value count as off. It has no effect elsewhere, since live sites are always counted. Remove it when you're done.

W_PENCIL_CLOUD_URL

PHP
define( 'W_PENCIL_CLOUD_URL', 'http://w-pencil.ddev.site:33001' );

Points the plugin at another W-Pencil cloud, like a local copy for working on W-Pencil itself. It must start with http:// or https://, and both your browser and your web server must reach it. Connecting, credits and updates all go there.

It's honoured on local development hosts only. A live site always talks to https://w-pencil.cloud.

Local development hosts are localhost, 127.0.0.1, *.ddev.site, *.lndo.site, *.docksal.site, *.test, *.local and *.localhost. Local development has more.

The settings page's settings

W-Pencil › Editing, Integrations and Left out write one option, w_pencil_settings:

  • default_mode: 'on' or 'off', whether editing is on when a page opens. Default 'on'.
  • toolbar_position: top-left, top-center, top-right, bottom-left, bottom-center or bottom-right. Default bottom-center.
  • toolbar_offset: the toolbar's distance from the edge in pixels, 0 to 400, or empty for the default.
  • pencil_position: top-right, top-left, bottom-right or bottom-left. Default top-right.
  • outline_color, pencil_bg and pencil_color: colours like '#2563eb'. Defaults '#2563eb', '#ffffff' and '#2563eb'.
  • revision_message: whether the popup asks for a revision message. Default off.
  • max_upload_mb: the largest image upload, from 1 to what the server allows. Default 10.
  • integrations: modes switched off, by ID (gutenberg, acf, elementor, menus, site, core). A mode that isn't listed is on when its plugin is found.
  • left_out: post types, block types and Elementor widgets that get no pencils. Field modes explains them.

Who may edit on the page isn't a setting: it's the w_pencil_use and w_pencil_more_fields capabilities of each role, which W-Pencil › Editing ticks for you. Permissions.

Where W-Pencil keeps the rest

  • Options, none of them loaded on every page: the connection (w_pencil_connection: the site's ID, origin, account, key fingerprint and, without W_PENCIL_KEY, the private key), the latest credit figures (w_pencil_credits), and a few small states: w_pencil_out, w_pencil_offline, w_pencil_skew, w_pencil_copy, w_pencil_disconnected and w_pencil_db_version.
  • Three tables, with your table prefix: w_pencil_lease, the edits the site may spend before asking again; w_pencil_outbox, saves not reported yet; and w_pencil_log, the activity under W-Pencil › Activity, kept 90 days.
  • Short-lived values, in transients: each editor's last save of each item, kept 10 minutes so Undo can be told apart; connect requests, kept 10 minutes; and the newest release's manifest, kept 6 hours.
  • Revision notes: the "Edited on the page: …" line of each revision, in the revision's _w_pencil_log meta.

A site key pasted on W-Pencil › Account or given to wp w-pencil connect --key is sent once and kept nowhere on the site.

Uninstalling removes all of this without telling W-Pencil. Deleting the plugin drops the tables and deletes the options, transients, capabilities, scheduled events and revision notes, but the site stays listed as connected in your dashboard. Disconnect first, on W-Pencil › Account or with wp w-pencil disconnect. Content edited with W-Pencil and uploaded images are never touched.

Next in Reference

The plugin and the cloud.

When your site talks to w-pencil.cloud, exactly what it sends, what comes back and what happens when the answer is no. Updates, and the routes on your site.