brewedbits.dev

Personal blog with guides and news on selfhosting, Linux and AI, from the Netherlands

nextDash nextdash --aboutYour bookmarks. Your terminal. checks your links knows your Docker host one container, no cloudLive demo →nextdash.cc ↗

Tip: wp config list prints what wp-config.php defines, with a filter

Wp-Config
~/tips/tip-wordpress-config-list

wp config list WP_DEBUG

Lists constants and variables from wp-config.php, optionally filtered by name.

Opening wp-config.php to check one constant means scrolling past the salts and the comments. WP-CLI can list just the part I ask for.

wp config list lists the variables, constants and file includes defined in wp-config.php, as a table with key, value and type. Add a name, or part of a name, as a filter:

wp config list WP_DEBUG

Without --strict the filter matches partial names, so this gives every entry with DEBUG in its name:

wp config list DEBUG

With --strict only exact names match, and you can pass several:

wp config list WP_DEBUG WP_DEBUG_LOG --strict --fields=key,value

The formats are table, csv, json, yaml and dotenv, and dotenv is limited to non-object values. --config-file=<path> reads another file than wp-config.php in the WordPress root. That option was added in WP-CLI 2.6.0, according to the docs.

A plain wp config list prints the database password and the salts too, as the docs example shows. Do not run it during a screen share or paste its output into a forum post or chat. Filter first.

The command reads the file, not the running site. A constant defined somewhere else will not show up.

Further reading: wp config list (WP-CLI handbook)

More Wp-Config tips ls -ld wp-content wp-content/plugins index.php define( 'WP_TEMP_DIR', '/var/www/example.com/tmp' ); define( 'CONCATENATE_SCRIPTS', false ); define( 'CORE_UPGRADE_SKIP_NEW_BUNDLED', true ); define( 'ALTERNATE_WP_CRON', true ); All Wp-Config tips (7) All topics

Link