钩子文档

oembed_linktypes

💡 云策文档标注

概述

oembed_linktypes 过滤器用于修改包含 oEmbed 提供者 URL 的链接类型数组。它允许开发者自定义支持的 oEmbed 格式,如 JSON 或 XML。

关键要点

  • 过滤器名称:oembed_linktypes
  • 参数:一个数组,包含 oEmbed 链接类型,如 'application/json+oembed'、'text/xml+oembed' 和 'application/xml+oembed'
  • 默认值:数组映射链接类型到简写格式(如 'json' 或 'xml')
  • 相关函数:WP_oEmbed::discover() 使用此过滤器来发现 oEmbed 提供者
  • 引入版本:WordPress 2.9.0

📄 原文内容

Filters the link types that contain oEmbed provider URLs.

Parameters

$formatstring[]
Array of oEmbed link types. Accepts 'application/json+oembed', 'text/xml+oembed', and 'application/xml+oembed' (incorrect, used by at least Vimeo).

Source

$linktypes = apply_filters(
	'oembed_linktypes',
	array(
		'application/json+oembed' => 'json',
		'text/xml+oembed'         => 'xml',
		'application/xml+oembed'  => 'xml',
	)
);

Changelog

Version Description
2.9.0 Introduced.