How to get database connection details without longing to cpanel in WordPress?
Question
I am creating a WordPress plugin and in my plugin i need to do some SQL statements ,in the site i am working on i have access to WP-admin but i cant get to the files to get database name and password from WP-config that i need in
mysqli_connect("host", "user_name", "password","database_name");
i believe there is a way to do that in PHP like all plugins in WordPress but i couldn't find out how !
Solution
both answers were great and helped me a lot ,i used the following to get to wp-config file without really Knowing all database details
require_once('../wp-config.php');
include_once ('../wp-load.php');
$con = mysqli_connect(DB_HOST, DB_USER, DB_PASSWORD , DB_NAME);
Licensed under: CC-BY-SA with attribution
Not affiliated with wordpress.stackexchange