How to retrieve current database name, user and password of a WordPress site



When you are working on WordPress development (theme deelopment or plugin development), probably you will need to retrieve current website database name, database user and password. To get those information you can write these lines on your theme/plugin:

global $wpdb;
echo $wpdb->dbname;
echo $wpdb->dbuser;
echo $wpdb->dbpassword;

The last three lines will echo the database name, username and password.

Hope that’s helpful.

loading...

Leave a Reply

Your email address will not be published.