WordPress.org

Make WordPress Core

Ticket #34064: 34064.diff

File 34064.diff, 955 bytes (added by kraftbj, 5 years ago)

first pass at filter.

  • src/wp-admin/includes/file.php

     
    318318                        $file['name'] = $proper_filename;
    319319                }
    320320                if ( ( ! $type || !$ext ) && ! current_user_can( 'unfiltered_upload' ) ) {
    321                         return call_user_func( $upload_error_handler, $file, __( 'Sorry, this file type is not permitted for security reasons.' ) );
     321                                /**
     322                                 * Filter the error type when a disallowed file type upload has been attempted.
     323                                 *
     324                                 * @since 4.4.0
     325                                 *
     326                                 * @param string $var Default error message: "Sorry, this file type is not permitted for security reasons."
     327                                 */
     328                        return call_user_func( $upload_error_handler, $file, apply_filters( 'upload_filetype_error', __( 'Sorry, this file type is not permitted for security reasons.' ) ) );
    322329                }
    323330                if ( ! $type ) {
    324331                        $type = $file['type'];