---
title: Accessing A WordPress Database with Pressable
url: "https://pressable.com/knowledgebase/access-wordpress-database-with-pressable/"
published: 2019-08-22
modified: 2025-10-07
author: Wayne McWilliams
---

## How to Access a WordPress Database

For security reasons, we do not allow remote access to a Pressable site’s database. For more information, please see our [Platform and Service Considerations](https://pressable.com/knowledgebase/service-platform-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:

```
<?phprequire '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.

- You can create a `.php` file inside the site root `/htdocs `to add custom PHP scripts below
- You can then access the script by visiting its URL in your browser (e.g., `http://yourwebsite.com/your_script.php`).

```
<?phprequire 'wp-load.php';// Display WP database credentialsecho "DB NAME :".DB_NAME ."<br>";echo "DB USER :".DB_USER ."<br>";echo "DB HOST :".DB_HOST ."<br>";echo "DB PASSWORD :".DB_PASSWORD;
```

 
 Important:  After using the database file, please remove it from the site root directory /htdocs. Leaving the file there is a security risk.

If you have any questions, please contact support.
