Automattic\WooCommerce\Internal\Font
FontFace::handle_font_file_upload_error()
Handles file upload error.
Copied from Gutenberg: https://github.com/WordPress/gutenberg/blob/b283c47dba96d74dd7589a823d8ab84c9e5a4765/lib/compat/wordpress-6.5/fonts/class-wp-rest-font-faces-controller.php/#L859-L883
Метод класса: FontFace{}
Хуков нет.
Возвращает
WP_Error
. WP_Error object.
Использование
$result = FontFace::handle_font_file_upload_error( $file, $message );
- $file(массив) (обязательный)
- File upload data.
- $message(строка) (обязательный)
- Error message from wp_handle_upload().
Код FontFace::handle_font_file_upload_error() FontFace::handle font file upload error WC 9.6.1
private static 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.', 'woocommerce' ) === $message ) { $status = 400; $code = 'rest_font_upload_invalid_file_type'; } return new \WP_Error( $code, $message, array( 'status' => $status ) ); }