How To Make Connection To WordPress Data Base In A Plugin?

How To Make Connection To WordPress Data Base In A Plugin?

Option 1: is to not use a database and instead use JSON or XML to store the data. This is suitable for small amounts of information. Send the client all the data and use JavaScript to expose what the client wants.

Option 2 is to use a database. This option is best for large amounts of data. WordPress already uses a database, one based on SQL. You will need access to the database and you’ll need to add a table (or multiple) and populate it with your data. Then you need to use SQL queries to query the data. This will also involve a client side script managing the data coming from the server.

We found the answer my self. First open your wp-config.php and check the bottom of file that Is that contain the below code?.

If yes then add the below code to make the connection in your plugin PHP files to connect with wp-config.php file that contain Database Name, Database UserName, Database Password, Database Host… …

And you will get connection to WordPress database…

3.2/5 - (4 votes)