How to get database name from wp-config.php using wp-cli call?

I am writing a perl script to migrate Wordpress installations from one location to another. In this work I need to get the wordpress database name from the wp-config file using wp-cli calls. So please let me know how to call the wp-cli function from a perl script to get the db name from wp-config.php.

+3


source to share


1 answer


Assuming you've already figured out how to invoke an external process with Perl, this is the wp-cli command you'll need:



wp eval 'echo DB_NAME;'

      

+10


source







All Articles