Skip to main content

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

FlagDescription
IDID of the site to empty
--yesSkip 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

Featurewp site emptywp site delete
TablesRetainedDeleted
UsersRetainedRetained (Network users)
SettingsRetainedDeleted
URLLiveDead

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