钩子文档

oembed_iframe_title_attribute

💡 云策文档标注

概述

本文档介绍 WordPress 中的 oembed_iframe_title_attribute 过滤器,用于修改 oEmbed HTML iframe 的 title 属性。开发者可以通过此 Hook 自定义嵌入内容的标题文本。

关键要点

  • oembed_iframe_title_attribute 是一个过滤器,允许开发者修改 oEmbed iframe 的 title 属性值。
  • 过滤器接收四个参数:$title(当前标题属性值)、$result(oEmbed HTML 结果)、$data(oEmbed 提供者的数据对象)和 $url(嵌入内容的 URL)。
  • 此过滤器在 WordPress 5.2.0 版本中引入,与 wp_filter_oembed_iframe_title_attribute() 函数相关,用于确保 iframe 具有 title 属性。

代码示例

$title = apply_filters( 'oembed_iframe_title_attribute', $title, $result, $data, $url );

📄 原文内容

Filters the title attribute of the given oEmbed HTML iframe.

Parameters

$titlestring
The title attribute.
$resultstring
The oEmbed HTML result.
$dataobject
A data object result from an oEmbed provider.
$urlstring
The URL of the content to be embedded.

Source

$title = apply_filters( 'oembed_iframe_title_attribute', $title, $result, $data, $url );

Changelog

Version Description
5.2.0 Introduced.