I want to get WordPress database name. I have also try to get database name from $wpdb but failed. When print the $wpdb it give an object array but i don’t know how to get database name from object array.

2 s
2

To get the db name using $wpdb:

global $wpdb;
echo $wpdb->dbname;

It will return database name as a string.

Tags:

Leave a Reply

Your email address will not be published. Required fields are marked *