钩子文档

embed_html

💡 云策文档标注

概述

embed_html 过滤器用于修改特定文章的嵌入 HTML 输出,允许开发者自定义 iframe 标签的显示内容。

关键要点

  • 过滤器名称:embed_html
  • 参数:$output(默认 iframe 标签字符串)、$post(WP_Post 对象)、$width(宽度整数)、$height(高度整数)
  • 返回值:通过 apply_filters 返回修改后的 HTML 字符串
  • 相关函数:get_post_embed_html() 用于获取文章的嵌入代码
  • 引入版本:WordPress 4.4.0

📄 原文内容

Filters the embed HTML output for a given post.

Parameters

$outputstring
The default iframe tag to display embedded content.
$postWP_Post
Current post object.
$widthint
Width of the response.
$heightint
Height of the response.

Source

return apply_filters( 'embed_html', $output, $post, $width, $height );

Changelog

Version Description
4.4.0 Introduced.