SQL queries to another wordpress site
I have 2 wordpress sites on the same hosting and the same host/user/ password for the database
I have on the other hand 2 different database and 2 different prefixes
I need, during an action on site1, to go and make requests on site2 (SELECT and after, UPDATE)
I saw that we could do
$mydb = new wpdb('username','password','database','localhost'); $rows = $mydb->get_results("select Name from my_table");
But putting that in site1’s functions.php file isn’t very secure is it?
How to do this in a clean way and avoid any attempt to hack the database if you access the functions.php file