钩子文档

get_edit_post_link

💡 云策文档标注

概述

get_edit_post_link 是一个 WordPress 过滤器,用于修改或过滤文章的编辑链接。它允许开发者在生成编辑链接时自定义其内容或行为。

关键要点

  • 过滤器名称:get_edit_post_link
  • 参数:$link(编辑链接字符串)、$post_id(文章ID)、$context(链接上下文,如 'display' 用于编码&符号)
  • 应用方式:通过 apply_filters 调用,可在主题或插件中挂钩以修改链接

代码示例

return apply_filters( 'get_edit_post_link', $link, $post->ID, $context );

📄 原文内容

Filters the post edit link.

Parameters

$linkstring
The edit link.
$post_idint
Post ID.
$contextstring
The link context. If set to 'display' then ampersands are encoded.

Source

return apply_filters( 'get_edit_post_link', $link, $post->ID, $context );

Changelog

Version Description
2.3.0 Introduced.