This code deletes a WordPress attachment given its attachment ID. It removes the attachment from the database and associated files from the filesystem. This code is useful for cleaning up media library when an attachment is no longer needed.
Was this code snippet helpful?
YesNo