Skip to content

Instantly share code, notes, and snippets.

@16am
Last active November 27, 2020 00:27
Show Gist options
  • Select an option

  • Save 16am/6564251 to your computer and use it in GitHub Desktop.

Select an option

Save 16am/6564251 to your computer and use it in GitHub Desktop.

Revisions

  1. 16am renamed this gist Dec 19, 2013. 1 changed file with 0 additions and 0 deletions.
    File renamed without changes.
  2. 16am revised this gist Sep 16, 2013. No changes.
  3. 16am revised this gist Sep 14, 2013. No changes.
  4. 16am created this gist Sep 14, 2013.
    9 changes: 9 additions & 0 deletions gistfile1.txt
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,9 @@
    add_filter( 'wp_generate_attachment_metadata', 'delete_fullsize_image' );
    function delete_fullsize_image( $metadata )
    {
    $upload_dir = wp_upload_dir();
    $full_image_path = trailingslashit( $upload_dir['basedir'] ) . $metadata['file'];
    $deleted = unlink( $full_image_path );

    return $metadata;
    }