Can WP-CLI modify database connection details in existing wp-config file?

You can use wp config set to update any existing value in wp-config or to add a new value: wp config set DB_NAME some_db_name wp config set DB_USER some_db_username wp config set DB_PASSWORD you_secret_value_pass See https://developer.wordpress.org/cli/commands/config/set/ Keep in mind that values are case sensitive, so if you do wp config set db_name some-db, it will … Read more

WordPress still requires FTP information

Guess it needs to be said first – it is a bad idea in general to just let anyone that succeeded to trick you into uploading his PHP onto your server to actually be able to write to your code directories. It is double problematic if you let him access to your root credentials and … Read more

Best function/method to access wp-config?

I am not aware of a WordPress function to do this. But have a look at this search and replace tool: https://interconnectit.com/products/search-and-replace-for-wordpress-databases/ This achieves what you want by reading in the wp-config file and scanning through it. Have a look at the function “icit_srdb_define_find” on line 374.