Created
March 11, 2013 13:22
-
-
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.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* 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