Skip to content

Instantly share code, notes, and snippets.

@benhuson
Created March 11, 2013 13:22
Show Gist options
  • Save benhuson/5134174 to your computer and use it in GitHub Desktop.
Save benhuson/5134174 to your computer and use it in GitHub Desktop.
Hide Tiff thumbnails in WordPress admin. Useful for when dealing with large TIFF files, thumbnail aren't created so it tries to load tiff image into media library.
/**
* Don't try to show TIFF thumbnails in admin
*/
function my_wp_prepare_attachment_for_js( $response, $attachment, $meta ) {
if ( is_admin() && $response['type'] == 'image' && in_array( $response['subtype'], array( 'tiff', 'tif' ) ) ) {
$response['type'] = 'application';
}
return $response;
}
add_filter( 'wp_prepare_attachment_for_js', 'my_wp_prepare_attachment_for_js', 10, 3 );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment