Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Prevent image thumbnails from being created during import
<?php
/**
* Filtering 'intermediate_image_sizes_advanced' to return an empty array
* prior to calling media_sideload_image() will prevent thumbnails from being created.
*/
add_filter( 'intermediate_image_sizes_advanced', '__return_empty_array' );
$attachment_id = media_sideload_image( $image_url, $post_id, '', 'id' );
remove_filter( 'intermediate_image_sizes_advanced', '__return_empty_array' );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.