钩子文档

month_link

💡 云策文档标注

概述

month_link 是一个 WordPress 过滤器钩子,用于修改月份归档页面的固定链接。它允许开发者自定义链接格式,基于年份和月份参数。

关键要点

  • month_link 是一个过滤器钩子,用于过滤月份归档的固定链接。
  • 它接受三个参数:$monthlink(当前链接字符串)、$year(年份整数)和$month(月份整数)。
  • 钩子在 get_month_link() 函数中被调用,用于生成月份归档链接。
  • 自 WordPress 1.5.0 版本引入,是核心链接模板系统的一部分。

📄 原文内容

Filters the month archive permalink.

Parameters

$monthlinkstring
Permalink for the month archive.
$yearint
Year for the archive.
$monthint
The month for the archive.

Source

return apply_filters( 'month_link', $monthlink, $year, $month );

Changelog

Version Description
1.5.0 Introduced.