函数文档

current_theme_info()

💡 云策文档标注

概述

current_theme_info() 是一个已弃用的 WordPress 函数,用于获取当前活动主题的信息。自 WordPress 3.4.0 起,建议使用 wp_get_theme() 替代。

关键要点

  • 函数 current_theme_info() 返回一个 WP_Theme 对象,包含当前主题的详细信息。
  • 该函数在 WordPress 3.4.0 版本中被标记为已弃用,开发者应改用 wp_get_theme() 函数。
  • 函数内部调用 _deprecated_function() 来提示弃用信息,并直接返回 wp_get_theme() 的结果。

注意事项

  • 在开发新代码时,避免使用 current_theme_info(),以保持兼容性和最佳实践。
  • 如果维护旧代码,建议逐步替换为 wp_get_theme(),以减少未来版本中的潜在问题。

📄 原文内容

Retrieves information on the current active theme.

Description

See also

Return

WP_Theme

Source

function current_theme_info() {
	_deprecated_function( __FUNCTION__, '3.4.0', 'wp_get_theme()' );

	return wp_get_theme();
}

Changelog

Version Description
3.4.0 Deprecated. Use wp_get_theme()
2.0.0 Introduced.