钩子文档

wp_update_php_url

💡 云策文档标注

概述

wp_update_php_url 是一个 WordPress 过滤器,用于修改获取 PHP 版本更新信息的 URL。它允许开发者自定义链接,指向关于更新站点运行 PHP 版本的更多信息页面。

关键要点

  • 过滤器名称:wp_update_php_url
  • 参数:$update_url(字符串类型),表示学习更新 PHP 的 URL
  • 不允许提供空字符串,否则将使用默认 URL
  • 链接页面最好本地化为站点语言
  • 引入版本:WordPress 5.1.0
  • 相关函数:wp_get_update_php_url() 用于获取此 URL

代码示例

$update_url = apply_filters( 'wp_update_php_url', $update_url );

注意事项

确保提供的 URL 有效且非空,以避免回退到默认值。建议链接内容针对站点语言进行本地化,以提升用户体验。


📄 原文内容

Filters the URL to learn more about updating the PHP version the site is running on.

Description

Providing an empty string is not allowed and will result in the default URL being used. Furthermore the page the URL links to should preferably be localized in the site language.

Parameters

$update_urlstring
URL to learn more about updating PHP.

Source

$update_url = apply_filters( 'wp_update_php_url', $update_url );

Changelog

Version Description
5.1.0 Introduced.