Skip to content

Storing credentials in wp-config

Keep a connection's credentials out of the database with a BOOLEANSMTP_{DRIVER}_{KEY} constant in wp-config.php or your server environment.

Updated View as Markdown

Every credential field a connection has can also be set from wp-config.php or your server’s environment instead of the database. A defined, non-empty constant always overrides the value stored for that field.

The naming rule

BOOLEANSMTP_{DRIVER}_{KEY}

— the connection’s driver, then the field’s key, both upper case.

Example: Custom SMTP

A Custom SMTP connection’s SMTP Username and Password fields are username and password, so setting these in wp-config.php overrides them for every Custom SMTP connection on the site:

define('BOOLEANSMTP_SMTP_USERNAME', 'your-smtp-username');
define('BOOLEANSMTP_SMTP_PASSWORD', 'your-smtp-password');

On the connection form, choose Credential Storage: WP Config to read the constant from wp-config.php, or Environment to read it as an OS environment variable instead — either way, leave the field itself blank.

Use a non-empty value. An empty constant or environment value does not replace a credential stored in the database; if there is no stored credential, the connection still needs one.

See the full list of constants for every driver’s field names and the constants BooleanSMTP reads outside connection settings.

Next steps

Was this helpful?

Documentation

Type to search…

↑↓ navigate↵ selectEsc close