钩子文档

embed_cache_oembed_types

💡 云策文档标注

概述

embed_cache_oembed_types 过滤器用于修改缓存 oEmbed 结果的帖子类型数组。它允许开发者自定义哪些帖子类型应缓存 oEmbed 数据,默认基于 show_ui 设置。

关键要点

  • 过滤器名称:embed_cache_oembed_types
  • 参数:$post_types,一个字符串数组,指定要缓存 oEmbed 结果的帖子类型名称
  • 默认值:show_ui 设置为 true 的帖子类型
  • 相关函数:WP_Embed::cache_oembed() 触发所有 oEmbed 结果的缓存
  • 引入版本:WordPress 2.9.0

📄 原文内容

Filters the array of post types to cache oEmbed results for.

Parameters

$post_typesstring[]
Array of post type names to cache oEmbed results for. Defaults to post types with show_ui set to true.

Source

$cache_oembed_types = apply_filters( 'embed_cache_oembed_types', $post_types );

Changelog

Version Description
2.9.0 Introduced.