PHPackages                             makers99/wp-cli-db-export-clean - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Database &amp; ORM](/categories/database)
4. /
5. makers99/wp-cli-db-export-clean

ActiveWp-cli-package[Database &amp; ORM](/categories/database)

makers99/wp-cli-db-export-clean
===============================

A WP-CLI command `wp db export-clean` to create a database dump without sensitive customer/user data.

1.0.0(3y ago)1121↑50%1[2 issues](https://github.com/makers99/wp-cli-db-export-clean/issues)GPL-2.0-or-laterPHPPHP &gt;=7.4

Since Mar 17Pushed 6mo ago5 watchersCompare

[ Source](https://github.com/makers99/wp-cli-db-export-clean)[ Packagist](https://packagist.org/packages/makers99/wp-cli-db-export-clean)[ Docs](https://github.com/makers99/wp-cli-db-export-clean)[ RSS](/packages/makers99-wp-cli-db-export-clean/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (1)Dependencies (1)Versions (2)Used By (0)

makers99/wp-cli-db-export-clean
===============================

[](#makers99wp-cli-db-export-clean)

Adds the WP-CLI command `wp db export-clean` to create a MySQL database dump without sensitive data related to customers and optionally API secrets/credentials, while retaining all administrative users and their related data.

Revisions are excluded as well to minimize the dump file size.

Quick links: [Usage](#usage) | [Integration](#integration) | [Installation](#installation) | [Support](#support)

Usage
-----

[](#usage)

```
wp db export-clean [] [--remove-keys]

```

### Arguments

[](#arguments)

The command accepts the result filename as argument. If omitted, it defaults to `./clean.sql`.

### Options

[](#options)

OptionDescriptionDefault`--remove-keys`Additionally remove options containing license keys and API credentials during dump.`false`### Examples

[](#examples)

- Create clean database dump in `./clean.sql`:

    ```
    $ wp db export-clean
    ```
- Create clean database dump in the user's home directory:

    ```
    $ wp db export-clean ~/clean.sql
    ```
- Exclude plugin license keys and API keys in the clean database dump – useful when working with plugin vendor support or unknown freelancers:

    ```
    $ wp db export-clean --remove-keys
    ```

Integration
-----------

[](#integration)

### Supported plugins

[](#supported-plugins)

- WordPress Core (keeping only posts and comments from retained users, omitting revisions, transients and caches)
- [WooCommerce](https://wordpress.org/plugins/woocommerce/) (only orders from retained users, omitting scheduled actions and sessions)
- [WooCommerce Subscriptions](https://woocommerce.com/products/woocommerce-subscriptions/) (only subscriptions from retained users)
- [Gravityforms](https://www.gravityforms.com/) (omitting revisions, entries, and statistics)
- [wp-lister-amazon](https://www.wplab.com/plugins/wp-lister-for-amazon/), [wp-lister-ebay](https://www.wplab.com/plugins/wp-lister-for-ebay/) (omitting feeds, jobs, logs)
- [Yoast wordpress-seo](https://wordpress.org/plugins/wordpress-seo/) (omitting index tracking, migrations, links)

### Placing the filter hooks

[](#placing-the-filter-hooks)

`wp db export-clean` runs directly after WordPress is loaded (like `wp db export`), which means that only wp-config.php and plugins are loaded but WordPress is not bootstrapped with init hooks. You can place your hooks into a must-use plugin; for example:

`wp-content/mu-plugins/wp-cli-db-export-clean.php`:

```
