钩子文档

pre_get_available_post_mime_types

💡 云策文档标注

概述

pre_get_available_post_mime_types 是一个 WordPress 过滤器,用于修改指定文章类型可用的 MIME 类型列表。它通常在 get_available_post_mime_types() 函数中被调用,允许开发者动态调整 MIME 类型数组。

关键要点

  • 这是一个过滤器 Hook,用于过滤指定文章类型的可用 MIME 类型列表。
  • 参数包括 $mime_types(MIME 类型数组,默认为 null)和 $type(文章类型名称,通常为 'attachment')。
  • 在 WordPress 6.4.0 版本中引入,与 get_available_post_mime_types() 函数相关。

📄 原文内容

Filters the list of available post MIME types for the given post type.

Parameters

$mime_typesstring[]|null
An array of MIME types. Default null.
$typestring
The post type name. Usually 'attachment' but can be any post type.

Source

$mime_types = apply_filters( 'pre_get_available_post_mime_types', null, $type );

Changelog

Version Description
6.4.0 Introduced.