Restore media is a WordPress ability from Imagify — usable via Easy MCP AI, which connects Claude, ChatGPT, and any AI assistant to your site.

Install Free Plugin →

Restore media

Destructive
Imagify Content & Tools imagify/restore-media

Restores a previously optimized media attachment back to its original file using the stored backup.

Requires the Imagify plugin on WordPress 6.9+ for the Abilities API (abilities are registered only when the wp_register_ability() function exists). Most abilities are gated by the Imagify 'manage' capability, resolved through Imagify's own capability abstraction (honors the imagify_capacity filter and multisite network-admin logic; equivalent to manage_options by default); the bulk-optimize, generate-missing-nextgen, and restore-media abilities instead check the WordPress 'manage_options' capability directly.

What it does

This ability restores a single WordPress media attachment (or custom-folder file) to its original, pre-optimization state by calling the plugin's existing AbstractProcess::restore() method, which requires that the 'keep backup of original images' setting was enabled at optimization time. It resolves the correct optimization process for the given media_id (trying the WordPress media-library context first, then falling back to the custom-folders context), verifies the media is actually optimized, and returns an error if no backup is available or the media can't be found. On success it reports the restored original file's size in bytes.

See it in action

You ask your AI assistant

"Restore media attachment #4821 back to its original, unoptimized file."

Inputs

Name Type Required Description
media_id integer Yes The WordPress attachment ID to restore.

Returns

An object with 'status' (success or error), 'restored_size' (the restored original file size in bytes, or null on error), and 'error_message' (null on success).

Permission

The current user must have the WordPress 'manage_options' capability (checked directly via current_user_can(), not routed through Imagify's capability abstraction).

Newsletter

The AI + WordPress space moves fast. Keep up.

New tools, workflow ideas, and product updates — be the first to know what's next.

No spam, unsubscribe anytime.