I am learning Plugins and I am trying to connect WordPress database wp-config.php
in my Plugin PHP code. Currently for checking my code, I used the below connection and it is working fine. Now I converted it into a WordPress plugin so anyone can use this but now its time to make WordPress database connection.
//Connection To DataBase
$host = "XXXXXXXXXXXXXX";
$username = "XXXXXXXXXX";
$password = "XXXXXXXXXX";
$dbname = "XXXXXXXXXXXX";
$connection = mysql_connect($host, $username, $password);
mysql_select_db($dbname);
So How to insert wp-config.php
like something require_once(wp-config.php');
in plugin instead of above code to make WordPress SQL database connection in my plugin file?