wp-cli / wp-config-transformer

Programmatically edit a wp-config.php file
MIT License
81 stars 25 forks source link

Is it possible to add comments above the constant in wp-config? #31

Closed codex-m closed 3 years ago

codex-m commented 3 years ago

I am searching this in the docs or options but could not find it :) Supposing I have this constant to be added to wp-config:

define('MYTEST_CONSTANT', 'somevalue);

Is it possible to programmatically add a comment above it? Example:

/** * Please do not remove this constant manually */ define('MYTEST_CONSTANT', 'somevalue);

The text comment: Please do not remove this constant manually is the one to be added programmatically via WP-config transformer library. I am not sure if this is possible? Thanks.

frankiejarrett commented 3 years ago

Hey there, no that is not supported by this library. It can only create, edit, or delete PHP constants and variable definitions. You would need to add this yourself to the file first then perhaps use that has your anchor string to place the constant definition immediately after it.

codex-m commented 3 years ago

Thanks for the info!