You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
wp config create would benefit from clear path to defer all parameter initialization. #124
It would seem to me that the optional/required parameters for wp config create are a little overbearing, especially considering the capabilities of wp config set. I don't see a strong reason why all of the parameters shouldn't be optional.
Verification is important, but given the wide variety of environments out there, the host/user only requirement seems very over/under in regards to actually having all the info to verify a connection (I'm assuming the purpose of them being required is to conduct that test).
Given the kitchen sink list of parameters possibly required, and the comparative ease of use of wp config set. It would be nice if there was an official, clearly indicated way to jump over to the for-each usage style.
I would prefer a flag that indicates this intention and skips the checks, but the command documentation could more clearly steer users to this possibility, as well.
I'm sure many users, like myself, are also interested in simplifying the injection of these parameters from the environment variables already present in their Docker container. At that point, you are already for-eaching in a bunch of (possibly missing) parameters, so why not include the other two.
To support setting all parameters in a for-each style like this (unrolled for clarity):
bash-5.1$ wp config set DB_NAME wordpressSuccess: Updated the constant 'DB_NAME' in the 'wp-config.php' file with the value 'wordpress'.bash-5.1$ wp config set DB_USER rootSuccess: Updated the constant 'DB_USER' in the 'wp-config.php' file with the value 'root'.bash-5.1$ wp config set DB_PASSWORD exampleSuccess: Updated the constant 'DB_PASSWORD' in the 'wp-config.php' file with the value 'example'.
changed the title [-]Create would benefit from clear path to defer all parameter initialization.[/-][+]`wp config create` would benefit from clear path to defer all parameter initialization.[/+]on Mar 21, 2021
I'm open to the idea of making --dbname=<dbname> and --dbuser=<dbuser> optional. This is relevant for SQLite support too (#167). However, if we did so, we'd need to mark it as a breaking change, because there's some rare scenario where a script could be dependent on the current error behavior if dbname or dbuser are missing.
Another option (not necessarily a good one) is to introduce a wp config init or similar command that makes a very basic wp-config.php and incorporates different behavior.
cc @wp-cli/committers if there are other opinions.
Looks like this was (at least partially) addressed with #219, but perhaps if the optional case is only scoped to sqlite, it may not entirely address the spirit of the original ask.
Activity
[-]Create would benefit from clear path to defer all parameter initialization.[/-][+]`wp config create` would benefit from clear path to defer all parameter initialization.[/+]danielbachhuber commentedon Nov 10, 2023
Thanks for the suggestion, @JollyWizard !
I'm open to the idea of making
--dbname=<dbname>and--dbuser=<dbuser>optional. This is relevant for SQLite support too (#167). However, if we did so, we'd need to mark it as a breaking change, because there's some rare scenario where a script could be dependent on the current error behavior if dbname or dbuser are missing.We're likely to tag a WP-CLI 3.0.0 in the next year (https://github.com/wp-cli/wp-cli/milestone/70), and could include this change in that release.
Another option (not necessarily a good one) is to introduce a
wp config initor similar command that makes a very basicwp-config.phpand incorporates different behavior.cc @wp-cli/committers if there are other opinions.
schplurtz commentedon May 4, 2024
I'd really like to see that in wp 3.0. Whatever the solution used, this would be really useful.
pwtyler commentedon Apr 14, 2026
Looks like this was (at least partially) addressed with #219, but perhaps if the optional case is only scoped to sqlite, it may not entirely address the spirit of the original ask.
swissspidy commentedon Apr 14, 2026
I suppose we could remove that SQLite drop-in check entirely to address this fully.
swissspidy commentedon Apr 15, 2026
#223 looks reasonable: make the arguments optional if either SQLite is detected or
--skip-checkis used.