Aleksi Lepp?nen
Forum Replies Created
-
I did some digging and it turns out Imagify wastefully prints out a hidden pricing modal in the
admin_footer
hook on every single page load in all pages of the wp-admin. It doesn’t even check if the site already has an active subscription making the pricing modal useless.The modal uses the aforementioned heavy SQL query to count the number of original images on the site to show in the modal. The image below shows the hidden modal made visible with browser devtools.
The following code snippet can be used to disable the rendering of the modal until the developers optimize their code to only load the modal when necessary.
<?php
/**
* Stops the Imagify payment modal from printing which
* calls the slow imagify_count_attachments function
* that slows down the wp-admin.
*
* @see https://www.ads-software.com/support/topic/imagify-causing-slow-down-across-all-wp-admin-slow-query/
*/
function disable_slow_imagify_payment_modal() {
if (class_exists('\\Imagify_Views') && method_exists('\\Imagify_Views', 'get_instance')) {
$imagify_views = \Imagify_Views::get_instance();
remove_action('admin_footer', [$imagify_views, 'print_modal_payment']);
}
}
add_action('admin_footer', 'disable_slow_imagify_payment_modal', 5);This obviously makes the modal unusable, but it shouldn’t matter if the site already has an active subscription.
Disabling the modal drastically reduced the load time from 13s to 0.5s on a site with ~47k images.
The imagify-beat-control plugin offered as a solution by the plugin author doesn’t solve this.
- This reply was modified 1 week, 3 days ago by Aleksi Lepp?nen. Reason: Address the solution offered by the plugin author