Hello,
I am trying to hook the wp_insert_attachment function of wordpress,
because I would like to preprocess the file upload from gravityforms.
in the gravityforms function media_handle_upload I noticed the call to
wp_insert_attachment like this:
// Save the data
$id = wp_insert_attachment($attachment, $file, $post_id);
if ( !is_wp_error($id) ) {
wp_update_attachment_metadata( $id, wp_generate_attachment_metadata( $id, $file ) );
}
I did the following in my plugin:
public function __construct() {
add_filter( 'wp_insert_attachment', array( $this, 'filter_insert' ), 1, 3 );
}
and the filter_insert function looks like this:
public function filter_insert( $attachment, $file, $id){
exit;
}
The result is, that the filter_insert function is not called...
best
regards
kubante