函数原型
get_registered_theme_feature( string $feature ): array|null
函数描述
Gets the registration config for a theme feature.
是否弃用
未弃用
函数参数
-
$feature
string
Required - The feature name. See add_theme_support() for the list of possible values.
More Arguments from add_theme_support( … $feature )
The feature being added. Likely core values include:
'admin-bar''align-wide''automatic-feed-links''core-block-patterns''custom-background''custom-header''custom-line-height''custom-logo''customize-selective-refresh-widgets''custom-spacing''custom-units''dark-editor-style''disable-custom-colors''disable-custom-font-sizes''editor-color-palette''editor-gradient-presets''editor-font-sizes''editor-styles''featured-content''html5''menus''post-formats''post-thumbnails''responsive-embeds''starter-content''title-tag''wp-block-styles''widgets''widgets-block-editor'
函数返回值
array|null The registration args, or null if the feature was not registered.
函数位置
File: wp-includes/theme.php.
函数源码
function get_registered_theme_feature( $feature ) {
global $_wp_registered_theme_features;
if ( ! is_array( $_wp_registered_theme_features ) ) {
return null;
}
return isset( $_wp_registered_theme_features[ $feature ] ) ? $_wp_registered_theme_features[ $feature ] : null;
}
源码链接
变更日志
| Version | Description |
|---|---|
| 5.5.0 | Introduced. |

