Viewing 2 replies - 1 through 2 (of 2 total)
  • Thread Starter nicmare

    (@nicmare)

    ok, found “noresize” for filenames to exclude images from imsanity resizing. would be awesome to have an additional apply_filters for that too! so i can control it via my theme functions instead of a filename!

    Thread Starter nicmare

    (@nicmare)

    Alright, here is the ultimate work around to get imsanity exclude custom post types:

    function custom_upload_filter( $file ){
    	if(get_post_type($_REQUEST['post_id']) == 'slider')
    		$file['name'] = 'noresize_' . $file['name'];
    	return $file;
    }
    add_filter('wp_handle_upload_prefilter', 'custom_upload_filter' );

    i use a wp hook where i look if the current post is a specific post type. in this case “slider”. if so, then prepend “noresize_” to the filname. because then imsanity will ignore resizing of the image. works like a charm! pretty simple but effective as long as there is no problem renaming the file.

Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘disable imsanity for certain post types?’ is closed to new replies.