wp-cli / wp-config-transformer

Programmatically edit a wp-config.php file

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

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

codex-m opened this issue · comments

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.

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.

Thanks for the info!