filesystem()->getMediaImage($attachment_id); if (! is_object($image)) { return; } $changes = false; $thumbObj = $image->getThumbnail($size); if (is_object($thumbObj)) { $thumbObj->onDelete(true); $changes = true; } else { } if ( true === $changes) { $image->saveMeta(); } } } // class $t = new TotalTheme();