Skip to content
Media CloudDocs
Happy HolidaysSave 20% with codeValid through December 31Shop the sale
Library Maintenance
On this page

Library Maintenance

Verify cloud files, repair attachment metadata, remove local copies and rewrite storage keys after domain or provider changes.

2 min read·3 tags

Media Cloud includes maintenance tasks for repairing the relationship between the WordPress media library and cloud storage. Back up the database before using them.

Verify Library

Media Cloud → Tools → Verify Library checks that every attachment’s files exist in cloud storage and reports missing or mismatched objects.

  • Enable Include Local Files to also check attachments that are not on cloud storage.
  • The task writes a CSV report to wp-content/mcloud-reports.
  • Run it after a migration, after changing buckets, or when images are missing.

WP-CLI equivalent:

wp mediacloud:storage verify [--local] [--limit=<number>] [--offset=<number>] [--page=<number>]

Fix Cloud Metadata

Media Cloud → Tools → Fix Cloud Metadata repairs missing or incorrect cloud metadata on attachments. It can effectively reverse an Unlink From Cloud run by reconnecting attachments to their storage objects.

Use it when:

  • Attachments exist in the bucket but WordPress does not know they are offloaded.
  • URLs are not being rewritten for some items.
  • A migration was interrupted.

The task writes a report and does not re-upload files.

Clean Uploads

Media Cloud → Tools → Clean Uploads deletes local files that belong to attachments already uploaded to cloud storage.

Important:

  • It only processes attachments that have cloud storage metadata.
  • It does not delete files in the uploads directory that are not associated with an attachment.
  • It removes empty directories after cleaning.
  • Use it only after verifying that cloud files exist and are publicly readable.

Rewrite storage keys

If the storage key prefix changed, for example after moving from a development domain to production, rewrite the attachment metadata:

wp mediacloud:storage fix-keys 'https://old.example.com/uploads/' 'uploads/'

The command accepts a search string and a replacement string. It updates attachment metadata and is not reversible. Back up the database first.

  1. Back up the database.
  2. Run Verify Library and review the report.
  3. Run fix-keys if keys contain an old domain or prefix.
  4. Run Fix Cloud Metadata.
  5. Run Clean Uploads only if you want to remove local copies.
  6. Open a sample of attachments on the front end and confirm the URLs.

For a full rollback to local storage, see Restoring Media to Local.

Need a hand with this guide?

Send support the exact step you’re stuck on and we’ll help you finish the setup.

Contact support
Start typing to search the docs

Escto close·⌘Kto open

View all results →