Accessing A WordPress Database with Pressable

How to Access a WordPress Database

For security reasons, we do not allow remote access to a Pressable site’s database. We also do not allow remote connections to external databases. For more information, please see our Platform and Service Considerations.

However, if you wish to connect to your Pressable site’s database programmatically from within your site, such as via PHP Data Objects (PDO) or MySQLi, you may do so.

If you’re using PDO or MySQLi within WordPress, you can use the PHP constants defined for database access:

require 'wp-load.php';
$connection = new mysqli(DB_HOST, DB_USER, DB_PASSWORD, DB_NAME);

If you are not accessing the database from within WordPress (i.e. via a PHP script that functions outside of WordPress), then you can use the following script to output the database credentials necessary for a PDO or MySQLi connection:

require 'wp-load.php';
// Display WP database credentials
echo "DB NAME :".DB_NAME ."<br>";
echo "DB USER :".DB_USER ."<br>";
echo "DB HOST :".DB_HOST ."<br>";

If you have any questions, please contact support.