Created
April 12, 2013 16:09
-
-
Save scrubmx/5373140 to your computer and use it in GitHub Desktop.
Filter through wordpress and custom image sizes and remove unwanted fields from the array
This file contains hidden or 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
| add_filter( 'intermediate_image_sizes', function($sizes){ | |
| $type = get_post_type($_REQUEST['post_id']); | |
| foreach($sizes as $key => $value){ | |
| if($type=='post_type' && $value != 'img_size_name'){ | |
| unset($sizes[$key]); | |
| } | |
| } | |
| return $sizes; | |
| }); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment