remove_custom_image_header()
云策文档标注
概述
remove_custom_image_header() 是一个已弃用的 WordPress 函数,用于移除主题的自定义图像头部支持。自 WordPress 3.4.0 起,建议使用 remove_theme_support('custom-header') 替代。
关键要点
- 函数 remove_custom_image_header() 已被弃用,从 WordPress 3.4.0 开始,应改用 remove_theme_support('custom-header')。
- 该函数返回 null 或布尔值,表示是否成功移除支持。
- 函数内部调用 _deprecated_function() 来标记弃用状态,并提示替代方案。
代码示例
function remove_custom_image_header() {
_deprecated_function( __FUNCTION__, '3.4.0', 'remove_theme_support( 'custom-header' )' );
return remove_theme_support( 'custom-header' );
}注意事项
- 在开发新主题或插件时,避免使用此已弃用函数,以确保代码兼容性和最佳实践。
- 相关函数包括 remove_theme_support() 和 _deprecated_function(),分别用于移除主题支持和标记弃用。
原文内容
Remove image header support.
Description
See also
Source
function remove_custom_image_header() {
_deprecated_function( __FUNCTION__, '3.4.0', 'remove_theme_support( 'custom-header' )' );
return remove_theme_support( 'custom-header' );
}
Changelog
| Version | Description |
|---|---|
| 3.4.0 | Deprecated. Use remove_theme_support() |
| 3.1.0 | Introduced. |