• in Version 3.2.6 in upload.php on line 269:
    do_action('wp_handle_upload', array('file' => $current_file, 'url' => wp_get_attachment_url($ID), 'type' => $new_filetype));

    The ‘wp_handle_upload’ filter is not called as filter but called as an action.

    This is important since the filter could actually change the filename, type and/or the url of the image (e.g. convert a bmp to jpg like imsanity or ewww image optimizer can do).

    compare this to the original WordPress code in file.php:

    	return apply_filters( 'wp_handle_upload', array(
    		'file' => $new_file,
    		'url'  => $url,
    		'type' => $type
    	), 'wp_handle_sideload' === $action ? 'sideload' : 'upload' );

    or in functions.php:
    return apply_filters( 'wp_handle_upload', array( 'file' => $new_file, 'url' => $url, 'type' => $wp_filetype['type'], 'error' => false ), 'sideload' );

    this might also help solving the issue about PDF previews which I posted earlier today.

Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
  • The topic ‘‘wp_handle_upload’ filter should be treated as such (and not as action)’ is closed to new replies.