WordPress Plugin

Easy to use, well tested and packed with bunch of features WordPress plugin for image optimizaiton.

Our WordPress plugin integrates with our API and allows you to easily optimize images in your Media Library, NextGen Gallery, any custom folders or other gallery plugins.

The plugin supports all common image formats such as JPEG, PNG, GIF (animated or non-animated)


Three different compression levels

Supports the three different compression levels: ultra, intelligent and lossless.

Backup & Restore options

Options to automatically backup image, restore if backup available or delete specific backups

Thumbnail optimization support

WordPress creates thumbnails for each full size image. You can choose which thumbnail versions to be optimized!

Retina support

Seamlessly integrates with WP Retina 2x and auto optimizes your retina images and thumbnails.

Supports many other plugins

Integrates with different gallery plugins(NextGen, MediaPress, Envira, Foo Gallery, Robo Gallery), CloudFlare, WP Offload S3, WP Stateless, etc.

Developer hooks

The plugin offers different developer hooks as follows:
(Note: This page is constantly updated to match the last version).


/**
 * Fired after attachment is optimized and before the process is finished.
 *
 * @param  MGO_MediaAttachment|MGO_LocalFileAttachment|MGO_NextGenAttachment $attachment_object
 * @param  array $request_params - The request parameters
 */
function megaoptim_before_optimization_238182812($attachment_object, $request_params) {
    // Do something
}
add_action('megaoptim_before_optimization', 'megaoptim_before_optimization_238182812', 15, 2);

/**
 * Fired after regular attachment is optimized
 *
 * @param  MGO_MediaAttachment|MGO_LocalFileAttachment|MGO_NextGenAttachment $attachment_object
 * @param  string $resource The url or the local path of the resource (If the site is local, the $resource will be local path, if the site is public the $resource will be url.)
 * @param  \MegaOptim\Responses\Response $response
 * @param  array $request_params - The request parameters
 * @param  string $size
 */
function megaoptim_attachment_optimized_238182812($attachment_object, $resource, $response, $request_params, $size) {
    // Do something
}
add_action('megaoptim_attachment_optimized', 'megaoptim_attachment_optimized_238182812', 15, 5);

/**
 * Fired after retina attachment is optimized.
 *
 * @param  MGO_MediaAttachment|MGO_LocalFileAttachment|MGO_NextGenAttachment $attachment_object
 * @param  string $resource The url or the local path of the resource (If the site is local, the $resource will be local path, if the site is public the $resource will be url.)
 * @param  \MegaOptim\Responses\Response $response
 * @param  array $request_params - The request parameters
 * @param  string $size
 */
function megaoptim_retina_attachment_optimized_238182812($attachment_object, $resource, $response, $request_params, $size) {
    // Do something
}
add_action('megaoptim_retina_attachment_optimized', 'megaoptim_retina_attachment_optimized_238182812', 15, 5);

/**
 * Fired after attachment is optimized and before the process is finished.
 *
 * @param  MGO_MediaAttachment $attachment_object
 * @param  array $request_params - The request parameters
 */
function megaoptim_before_finish_238182812($attachment_object, $request_params) {
    // Do something
}
add_action('megaoptim_before_finish', 'megaoptim_before_finish_238182812', 15, 2);


/**
 * Fired after the attachment is restored from backup.
 * MGO_MediaAttachment|MGO_LocalFileAttachment|MGO_NextGenAttachment $attachment_object
 */
function megaoptim_after_restore_attachment_283823842($attachment_object) {
    // Do something
}
add_action('megaoptim_after_restore_attachment', 'megaoptim_after_restore_attachment_283823842', 15, 1);