钩子文档

comment_max_links_url

💡 云策文档标注

概述

comment_max_links_url 是一个 WordPress 过滤器钩子,用于控制评论中允许的链接数量。它允许开发者基于评论内容、作者 URL 等参数动态调整链接限制。

关键要点

  • 这是一个过滤器钩子,用于过滤评论中的链接数量。
  • 参数包括 $num_links(链接数量)、$url(评论作者 URL)和 $comment(评论内容)。
  • 在 WordPress 4.7.0 版本中增加了 $comment 参数,3.0.0 版本引入。
  • 主要用于 check_comment() 函数中,检查评论是否允许添加。

📄 原文内容

Filters the number of links found in a comment.

Parameters

$num_linksint
The number of links found.
$urlstring
Comment author’s URL. Included in allowed links total.
$commentstring
Content of the comment.

Source

$num_links = apply_filters( 'comment_max_links_url', $num_links, $url, $comment );

Changelog

Version Description
4.7.0 Added the $comment parameter.
3.0.0 Introduced.