钩子文档

get_header_image

💡 云策文档标注

概述

本文档介绍了 WordPress 中的 get_header_image 过滤器,用于修改自定义标题图像的 URL。该过滤器在 get_header_image() 函数中被调用,允许开发者动态调整标题图像的来源。

关键要点

  • get_header_image 是一个过滤器,用于过滤标题图像的 URL。
  • 参数 $url 是字符串类型,表示当前的标题图像 URL。
  • 该过滤器在 wp-includes/theme.php 文件中定义,与 get_header_image() 函数相关。
  • 从 WordPress 6.1.0 版本开始引入。

代码示例

$url = apply_filters( 'get_header_image', $url );

📄 原文内容

Filters the header image URL.

Parameters

$urlstring
Header image URL.

Source

$url = apply_filters( 'get_header_image', $url );

Changelog

Version Description
6.1.0 Introduced.