Applies to core 0.1.2 and Pro 0.1.0. Check your installed release's help before running commands that change media.
Run commands from the intended WordPress installation with WP-CLI available and the core active. Supply the usual WP-CLI site/path context when operating multiple sites. The command namespace remains wp lf media after the Media Sentry rename. An asset-id is Media Sentry's asset ID, not the WordPress attachment ID. Example IDs below must be replaced with IDs from your own current reports.
Read-Only Checks and Reports
wp lf media doctor
wp lf media doctor --format=json
wp lf media inventory report --format=json
wp lf media references report --format=json
wp lf media duplicates_report --format=json
wp lf media classification_report --format=json
wp lf media cleanup_review_report --format=json
wp lf media cleanup_review_report --dry-run --format=json
wp lf media cleanup dry-run --format=json
wp lf media cleanup log --format=json --limit=100
wp lf media quarantine list --limit=100
wp lf media product-health --format=json --limit=100
The doctor reports schema versions, expected tables, and uploads access. Read its output: findings can be warnings rather than a nonzero exit status. Report commands read saved data, so an empty report may mean no complete scan exists.
Inventory, reference, duplicate, classification, and cleanup-review reports accept table (default), JSON, or CSV. Prefer JSON: the current CSV writer joins fields without proper CSV quoting. JSON reports include a summary, view, and rows and are capped at 10,000 rows. --limit is not a general report-pagination option; use it only on commands shown to support it. Doctor, product-health, dry-run, and cleanup log use table or JSON. Quarantine list uses table output.
Save a report to a new file in your chosen working directory:
wp lf media references report --format=json > media-sentry-references.json
Shell redirection replaces an existing file of that name. Reports may contain site paths and content details; review before sharing through Support.
Run Scans
This sequence inventories media, maps references, finds duplicates, and classifies results without moving image files:
wp lf media audit run
wp lf media duplicates_scan
wp lf media classify
audit run runs inventory and references only. It does not also analyze duplicates or complete every saved administrative baseline step. Use Setup Baseline for the full seven-step UI baseline, including derivatives and the saved product/system summaries.
To run inventory and usage separately:
wp lf media inventory scan --batch-size=100
wp lf media references scan
The inventory command accepts --limit for a bounded scan; such a scan is partial and must not be treated as a complete-site audit for cleanup. Reference and duplicate scans can use --inventory-batch-id. Classification accepts --inventory-batch-id, --reference-batch-id, and --duplicate-batch-id. Use only mutually consistent completed batches. Omitting IDs selects the services' latest completed data.
Dry Run Is Not Execution
wp lf media cleanup dry-run --asset-id=123 --format=json
This reports only candidates in the internal approved-for-dry-run state. It moves nothing and can be empty even when unused items exist. It is not a universal preview of everything the quarantine execution guard could accept. Current quarantine execution checks classification, references, protection, file state, and paths; it does not require a prior dry-run result. The current UI's Quarantine action begins execution rather than saving a preview-only approval.
Quarantine One Reviewed Asset (Pro)
The following command moves a file. It requires the Pro service and cleanup entitlement:
wp lf media cleanup quarantine --asset-id=123 --reason="Reviewed unused image" --yes
Use the current asset ID and confirm its evidence before running. --yes is required for this command. Failures are returned as errors; inspect them rather than bypassing checks.
Restore One Asset (Free)
This moves an intact quarantined file back to its original path without requiring Pro entitlement:
wp lf media cleanup restore --asset-id=123 --reason="Restore needed image" --yes
Restore requires --yes, a valid quarantine log and matching file, and an unoccupied destination. It cannot undo permanent deletion.
Explicit Action Batches
These commands create a batch and immediately process its first portion. Unlike the single-item cleanup commands, this batch interface does not wait for --yes. Remaining queued work can continue through background workers. Run only the one action you intend; these are alternatives, not a sequence to paste together.
Quarantine reviewed IDs (Pro):
wp lf media quarantine batch --action=quarantine --asset-ids=123,124 --limit=10
Restore a quarantined ID (free):
wp lf media quarantine batch --action=restore --asset-id=123 --limit=10
Permanently delete an eligible quarantined ID (Pro, irreversible):
wp lf media quarantine batch --action=permanent_delete --asset-id=123 --confirm=DELETE --limit=10
The delete action requires exact --confirm=DELETE, elapsed retention, and the service's other eligibility and hash checks. There is no documented retention-bypass command. --limit controls immediate processing size, not the total selected scope or eventual background execution.
Inspect the returned batch ID before deciding whether to continue it:
wp lf media quarantine status --batch-id=45
To explicitly process queued items for that existing, verified batch:
wp lf media quarantine process --batch-id=45 --limit=10
Processing carries out the action already saved in the batch, including permanent deletion, without asking for confirmation again. Avoid concurrent workers. Inspect failed_items, completed_items, and remaining: an overall ok result does not mean each item succeeded. Processing queued items does not automatically reset failed items for retry.
Unfinished and Unsupported Interfaces
schedule status can inspect the existing request hook, and schedule disable can remove its scheduled events. Enabling that hook does not implement recurring full audits: the handler records a request. Do not rely on it for automated monitoring. No automatic retention cleanup is implemented.
Historical development documents mention commands that are absent from the current class, such as hardening-report. They are not part of this reference. Internal PHP services, database tables, and entitlement filters are not a promised public API.
