I have SQL queries that I want to run automatically after wordpress installation has completed. I have a php file that will reference a .sql file and automatically run all of the queries inside it, however, you have to manually browse to example.com/updateDB.php to get it to run. I am trying to get everything completely automated so I would like to insert code somewhere in the wordpress installation that basically says to run this code as if it were browsed to in a browser.
I have tried multiple things including just putting the actual php from that file into several different spots in the installation code or trying curl, etc and nothing has worked.
So in the end my question is, how can I execute the code in this file AFTER wordpress installation has completed? I’ve gotten close a few times but the code wanted to run before the database was actually setup – which of course threw an error with my UPDATE queries in the .sql file.
Here is what presently occurs:
Setup empty db
Install WordPress
browse to http://www.example.com/updateDB.php
– code executes just fine and the db is updated.
Here is what I want to happen:
Setup empty db
Install WordPress
– At some point in the process my code is triggered and the db is updated with with the code from updateDB.php (referencing the .sql file).
The javascript should look something like this (obviously substituting your own file name):
Place it at the end of the install script.