Connect Another Database in WordPress

When you need to connect another database, create an instance of the wpdb class. Doing so, you get access to all available methods of wpdb class. The user can use these class methods directly to interact with the external database.

For getting started, you should have the credentials of an external database.

As said, it needs to create an instance of wpdb class. This instance should be available throughout the WordPress application. For this, add the below code in functions.php file.

For Customized/Bulk Order
Contact US