
如何使用WordPress钩子来提高技术性SEO
wp_get_update_php_url ( No parameters )
wp_get_update_php_url: 这个函数检索最新的可用PHP更新的URL。它返回一个包含最新PHP更新的URL的字符串,可以用来下载更新。
获取URL以了解更多关于更新网站运行的PHP版本。
这个URL可以通过指定环境变量`WP_UPDATE_PHP_URL`或使用{@see ‘wp_update_php_url’}过滤器来覆盖。提供一个空字符串是不允许的,这将导致使用默认的URL。此外,URL链接到的页面最好是用网站语言进行本地化。
function wp_get_update_php_url() { $default_url = wp_get_default_update_php_url(); $update_url = $default_url; if ( false !== getenv( 'WP_UPDATE_PHP_URL' ) ) { $update_url = getenv( 'WP_UPDATE_PHP_URL' ); } /** * Filters the URL to learn more about updating the PHP version the site is running on. * * 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. * * @since 5.1.0 * * @param string $update_url URL to learn more about updating PHP. */ $update_url = apply_filters( 'wp_update_php_url', $update_url ); if ( empty( $update_url ) ) { $update_url = $default_url; } return $update_url; }