钩子文档

the_shortlink

💡 云策文档标注

概述

the_shortlink 是一个 WordPress 过滤器,用于修改文章短链接的锚标签输出。它允许开发者自定义短链接的 HTML 结构、URL、文本和标题属性。

关键要点

  • 过滤器名称:the_shortlink
  • 参数:$link(锚标签)、$shortlink(短链接 URL)、$text(链接文本)、$title(标题属性,未使用)
  • 用途:在 the_shortlink() 函数中调用,用于显示文章短链接时过滤输出
  • 引入版本:WordPress 3.0.0

代码示例

$link = apply_filters( 'the_shortlink', $link, $shortlink, $text, $title );

📄 原文内容

Filters the short link anchor tag for a post.

Parameters

$linkstring
Shortlink anchor tag.
$shortlinkstring
Shortlink URL.
$textstring
Shortlink’s text.
$titlestring
Shortlink’s title attribute. Unused.

Source

$link = apply_filters( 'the_shortlink', $link, $shortlink, $text, $title );

Changelog

Version Description
3.0.0 Introduced.