The plugin hooks into the wp_update_attachment_metadata
filter to upload to files to s3, and this filter is called by the function wp_update_attachment_metadata()
, and this function is called by 12 other functions in wordpress and your wp_handle_upload()
and wp_insert_attachment()
functions are not one of them,here is the list.
wp_restore_image()
wp_save_image()
wp_generate_attachment_metadata()
media_handle_upload()
media_handle_sideload()
edit_post()
wp_ajax_save_attachment()
Custom_Image_Header::insert_attachment()
Custom_Image_Header::step_2()
Custom_Background::handle_upload()
wp_maybe_generate_attachment_metadata()
wp_xmlrpc_server::mw_newMediaObject()
Try using any of the above relevant function for your upload and the plugin will handle the rest.
On second thought your wp_insert_attachment()
function according to the codex should be used in conjunction with wp_update_attachment_metadata()
and wp_generate_attachment_metadata()
functions. And both of these functions triggers the filter wp_update_attachment_metadata
the plugin uses to upload files to s3 especially the wp_update_attachment_metadata()
function. Please check your code to make sure it conforms with the codex, and if it is,then the plugin should handle your uploads to s3.
Thanks,
I am now just calling media_handle_upload
It takes care of everything including upload and attachments & the file is now correctly uploaded to S3.
Thanks a lot for your help!
I can not get this to trigger from a front-end update. My code works just fine, but the
This is handling my upload fine:
$attachment_id = media_handle_upload( ‘my_image_upload’, $_POST[‘post_id’] );
But it’s AWS and S3 are not getting triggered. I’ve tried everything. I’ve had it call wp_update_attachment_metadata(), too, just for good measure.
I’ve tried tracking this backwards but I can’t seem to locate where it goes off the rails.
Following (sorry, forgot to hit that button)