函数文档

has_header_image()

💡 云策文档标注

概述

has_header_image() 是一个 WordPress 函数,用于检查是否设置了页眉图像。它基于 get_header_image() 的返回值进行布尔判断。

关键要点

  • 函数返回布尔值,表示页眉图像是否已设置
  • 内部调用 get_header_image() 并转换为布尔类型
  • 首次引入于 WordPress 4.2.0 版本
  • 相关函数包括 get_header_image() 和 has_custom_header()

📄 原文内容

Checks whether a header image is set or not.

Description

See also

Return

bool Whether a header image is set or not.

Source

function has_header_image() {
	return (bool) get_header_image();
}

Changelog

Version Description
4.2.0 Introduced.

User Contributed Notes