WP_REST_Font_Faces_Controller::handle_font_file_upload_error( array $file, string $message ): WP_Error

In this article

Handles file upload error.

Parameters

$filearrayrequired
File upload data.
$messagestringrequired
Error message from wp_handle_upload() .

Return

WP_Error WP_Error object.

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

VersionDescription
6.5.0Introduced.

User Contributed Notes

You must log in before being able to contribute a note or feedback.