I have a plugin which needs to update the WP database; however the critical function to do this is NOT on a WP page (it's called from a JS function in the background) so it doesn't have the WP Config file already loaded.
At the moment I've hardcoded the DB name/user/pass into the php function page but I'd rather access the WP config.php file and get these details directly in case the site is moved or the DB credentials are changed in future.
My config.php file is in the root of the directory; is there a simple way to access the DB credentials held there?