wp site empty
Overview
Reset a subsite by deleting all content (posts, pages, comments, terms) while keeping the site registration, users, and settings intact. Perfect for resetting a staging site or a sandbox.
Syntax
wp site empty <id> [--yes]
Options
| Flag | Description |
|---|---|
ID | ID of the site to empty |
--yes | Skip confirmation |
Basic Usage
wp site empty 5
Output:
Are you sure you want to empty the 'http://example.com/sandbox/' site? [y/n] y
Success: The site at 'http://example.com/sandbox/' was emptied.
Differences with wp site delete
| Feature | wp site empty | wp site delete |
|---|---|---|
| Tables | Retained | Deleted |
| Users | Retained | Retained (Network users) |
| Settings | Retained | Deleted |
| URL | Live | Dead |
Real-World Scenarios
Preparing a site for a new demo
# Empty existing content and load a new XML export
wp site empty 12 --yes
wp import demo-content.xml --url=example.com/demo-site
Quick Reference
wp site empty 2 --yes # Reset site 2
Next Steps
wp db clean— more aggressive database cleaning.