Conversation
supportHi, If the plugin is activated, when deleting an image, an error appears: Error in deleting the attachment. The plugin was registering a delete_attachment hook that called a method webpc_remove_original() in the main class, but this method didn’t exist. This caused a 500 error when trying to delete an image. Solution Add the missing method webpc_remove_original($attachment_id) to the WEBPCbySheepFish class. This method simply calls the static method of the same name in the WebpC_Remover class. Add method in webp-conversion.php (after webpc_remove_originals_selected ) – Line 674 (just before function webpc_convert_single ) : <?php /** * Hook callback for when an attachment is deleted. * Removes the backup/original file associated with the attachment. * * @param int $attachment_id The attachment ID being deleted. * @return void */ public function webpc_remove_original($attachment_id): void { WebpC_Remover::webpc_remove_original($attachment_id); } Root Cause Line 91 in webp-conversion.php registers the hook: add_action('delete_attachment', [$this, 'webpc_remove_original']); But the method webpc_remove_original() was not defined in the class, causing a fatal error when WordPress tries to delete an attachment. Regards
Hi @anissneo , Thank you for the solution, already fixed the issue. Please update plugin to the latest version. Best Regards, Denys
Alright, cool. Great plugin btw, i use it on several sites. Nice work
Hi @anissneo , Thank you for the solution, already fixed the issue. Please update plugin to the latest version. Best Regards, Denys
Alright, cool. Great plugin btw, i use it on several sites. Nice work