函数文档

get_site_allowed_themes()

💡 云策文档标注

概述

get_site_allowed_themes() 是一个已弃用的 WordPress 函数,用于获取网络启用的主题列表。建议开发者使用 WP_Theme::get_allowed_on_network() 作为替代。

关键要点

  • 函数 get_site_allowed_themes() 自 WordPress 3.4.0 起被弃用。
  • 替代函数是 WP_Theme::get_allowed_on_network(),它返回网络允许的主题样式表名称数组。
  • 弃用警告通过 _deprecated_function() 触发,提醒开发者更新代码。

代码示例

function get_site_allowed_themes() {
    _deprecated_function( __FUNCTION__, '3.4.0', 'WP_Theme::get_allowed_on_network()' );
    return array_map( 'intval', WP_Theme::get_allowed_on_network() );
}

注意事项

  • 在开发中应避免使用此弃用函数,以保持代码兼容性和最佳实践。
  • 相关函数包括 WP_Theme::get_allowed_on_network() 和 _deprecated_function(),用于替代和弃用处理。

📄 原文内容

Deprecated functionality for getting themes network-enabled themes.

Description

See also

Source

function get_site_allowed_themes() {
	_deprecated_function( __FUNCTION__, '3.4.0', 'WP_Theme::get_allowed_on_network()' );
	return array_map( 'intval', WP_Theme::get_allowed_on_network() );
}

Changelog

Version Description
3.4.0 Introduced.