钩子文档

post_embed_url

💡 云策文档标注

概述

post_embed_url 是一个 WordPress 过滤器,用于修改特定文章的嵌入 URL。它允许开发者在生成文章嵌入 URL 时进行自定义处理。

关键要点

  • 过滤器名称:post_embed_url
  • 参数:$embed_url(字符串,文章嵌入 URL)和 $post(WP_Post 对象,对应的文章对象)
  • 返回值:经过 sanitize_url 处理的 URL
  • 相关函数:get_post_embed_url() 用于检索文章嵌入 URL
  • 引入版本:WordPress 4.4.0

📄 原文内容

Filters the URL to embed a specific post.

Parameters

$embed_urlstring
The post embed URL.
$postWP_Post
The corresponding post object.

Source

return sanitize_url( apply_filters( 'post_embed_url', $embed_url, $post ) );

Changelog

Version Description
4.4.0 Introduced.