3

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

2
  • i used perl file handling to read db name from wp-config.php. But same is not possible with wp-cli calls? I am also want to add some new line s to wp-config.php Commented Feb 13, 2013 at 16:12
  • I don't know how use wp cli for add some new line s to wp-config.php. Only thing i know is wp core update command to update core Commented Feb 13, 2013 at 16:50

2 Answers 2

12

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

wp eval 'echo DB_NAME;'
Sign up to request clarification or add additional context in comments.

Comments

3

Another way to get it, without using eval, is to run

wp config get DB_NAME

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.