Handles file upload error.
Parameters
$file
arrayrequired- File upload data.
$message
stringrequired- Error message from wp_handle_upload() .
Source
public function handle_font_file_upload_error( $file, $message ) {
$status = 500;
$code = 'rest_font_upload_unknown_error';
if ( __( 'Sorry, you are not allowed to upload this file type.' ) === $message ) {
$status = 400;
$code = 'rest_font_upload_invalid_file_type';
}
return new WP_Error( $code, $message, array( 'status' => $status ) );
}
Changelog
Version | Description |
---|---|
6.5.0 | Introduced. |
User Contributed Notes
You must log in before being able to contribute a note or feedback.