Download the PHP package makers99/wp-cli-db-export-clean without Composer
On this page you can find all versions of the php package makers99/wp-cli-db-export-clean. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download makers99/wp-cli-db-export-clean
More information about makers99/wp-cli-db-export-clean
Files in makers99/wp-cli-db-export-clean
Package wp-cli-db-export-clean
Short Description A WP-CLI command `wp db export-clean` to create a database dump without sensitive customer/user data.
License GPL-2.0-or-later
Homepage https://github.com/makers99/wp-cli-db-export-clean
Informations about the package wp-cli-db-export-clean
makers99/wp-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: Support
Usage
Arguments
The command accepts the result filename as argument. If omitted, it defaults to
./clean.sql
.
Options
Option | Description | Default |
---|---|---|
--remove-keys |
Additionally remove options containing license keys and API credentials during dump. | false |
Examples
-
Create clean database dump in
./clean.sql
: -
Create clean database dump in the user's home directory:
- Exclude plugin license keys and API keys in the clean database dump – useful when working with plugin vendor support or unknown freelancers:
Integration
Supported plugins
- WordPress Core (keeping only posts and comments from retained users, omitting revisions, transients and caches)
- WooCommerce (only orders from retained users, omitting scheduled actions and sessions)
- WooCommerce Subscriptions (only subscriptions from retained users)
- Gravityforms (omitting revisions, entries, and statistics)
- wp-lister-amazon, wp-lister-ebay (omitting feeds, jobs, logs)
- Yoast wordpress-seo (omitting index tracking, migrations, links)
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
:
Including more users in the database export
wp db export-clean
only includes users having the role Administrator by default. Use the filter hook 'wp-db-export-clean/allowed-emails'
to include more users in the database dump:
In addition, you can include users by ID:
Including more WooCommerce orders or subscriptions in the database export
Excluding more/custom data in the database export
Implement the following filter hook to customize the where conditions for all tables.
Excluded licenses and API keys
When passing the --remove-keys
option, the following plugins are currently supported:
- WooCommerce (PayPal)
- WooCommerce PayPal Plus
- WooCommerce PayPal Express Checkout (woocommerce-gateway-paypal-express-checkout)
- wp-lister-amazon
- wp-lister-ebay
- Gravityforms
- WooThemes (wp-all-import, wp-all-export)
- Optimus
- Elementor
- SearchWP
- Gravityforms Zero Spam
- WooCommerce Amazon Payments
Installation
Install as package
- To install the latest version of this package for the current user:
Install as Git submodule
-
Add the package as submodule.
-
Register the command for early WP-CLI bootstrap.
Or manually:
Install with Composer
-
Install the package with Composer.
Note: Do not use
--dev
to install asrequire-dev
, because export-clean is typically used in production. -
Register the command for early WP-CLI bootstrap.
Or manually:
Support
MySQL errors during export
Add to wp-cli.yml
in your site root folder:
Come create with us!
Originally authored by Bogdan Arizancu and Daniel Kudwien.