Bulk optimize 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 →

Bulk optimize

Write
Imagify Content & Tools imagify/bulk-optimize

Schedules a bulk image-optimization run across the WordPress media library or Imagify's custom folders.

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 schedules a bulk optimization run for either the WordPress media library or Imagify's custom-folder sources, delegating to the plugin's Bulk::run_optimize() (the same routine the bulk-optimize button in wp-admin uses). An optional optimization_level (0 = normal, 1 = aggressive, 2 = ultra) overrides the site's default for the run. Because bulk optimization can consume a large share of the account's monthly quota, the call is gated by a credit-consumption guard: calling it without confirm=true returns a status of confirmation_required together with a preview of how many images would be processed, and the caller must resend the request with confirm: true to actually schedule the run; the guard also short-circuits with insufficient_quota or invalid_api_key if the account can't support it. On success the run is queued via Action Scheduler and the status is 'scheduled'.

See it in action

You ask your AI assistant

"Schedule a bulk optimization run for all unoptimized images in my WordPress media library using the aggressive level."

Inputs

Name Type Required Description
context string Yes Optimization context: 'wp' for the WordPress media library or 'custom-folders' for custom folder sources.
optimization_level integer No Optimization level: 0 (normal), 1 (aggressive), or 2 (ultra). Defaults to the global Imagify setting.
confirm boolean No Set to true to execute after reviewing the credit-consumption preview returned by a prior call without this flag. Defaults to false.

Returns

An object with 'status' (scheduled, error, confirmation_required, insufficient_quota, or invalid_api_key), 'context' (the requested optimization context, echoed back), 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.