WP_REST_Font_Faces_Controller::handle_font_file_upload_error()
Handles file upload error.
Method of the class: WP_REST_Font_Faces_Controller{}
No Hooks.
Return
WP_Error
. WP_Error object.
Usage
$WP_REST_Font_Faces_Controller = new WP_REST_Font_Faces_Controller(); $WP_REST_Font_Faces_Controller->handle_font_file_upload_error( $file, $message );
- $file(array) (required)
- File upload data.
- $message(string) (required)
- Error message from wp_handle_upload().
Changelog
Since 6.5.0 | Introduced. |
WP_REST_Font_Faces_Controller::handle_font_file_upload_error() WP REST Font Faces Controller::handle font file upload error code WP 6.6.2
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 ) ); }