钩子文档

image_editor_default_mime_type

💡 云策文档标注

概述

image_editor_default_mime_type 是一个 WordPress 过滤器钩子,用于在获取文件扩展名之前修改默认的 MIME 类型。它主要用于图像编辑类中,允许开发者自定义 MIME 类型处理。

关键要点

  • 这是一个过滤器钩子,名称为 image_editor_default_mime_type。
  • 用于在获取文件扩展名之前过滤默认的 MIME 类型字符串。
  • 参数为 $mime_type,是一个字符串类型的 MIME 类型。
  • 在 WP_Image_Editor::get_output_format() 方法中使用,用于确定输出格式的 MIME 类型和扩展名。
  • 自 WordPress 3.5.0 版本引入。

代码示例

$mime_type = apply_filters( 'image_editor_default_mime_type', $this->default_mime_type );

📄 原文内容

Filters default mime type prior to getting the file extension.

Description

See also

Parameters

$mime_typestring
Mime type string.

Source

$mime_type = apply_filters( 'image_editor_default_mime_type', $this->default_mime_type );

Changelog

Version Description
3.5.0 Introduced.