获取注册该支持时传递的主题支持参数

原型

get_theme_support( string $feature )

参数

$feature (string) (Required) 要检查的功能

返回值

(mixed)  额外参数数组或注册特征的值。

源文件

路径:wp-includes/theme.php

<?php
...
function get_theme_support( $feature ) {
	global $_wp_theme_features;
	if ( ! isset( $_wp_theme_features[ $feature ] ) )
		return false;
	if ( func_num_args() <= 1 )
		return $_wp_theme_features[ $feature ];
	$args = array_slice( func_get_args(), 1 );
	switch ( $feature ) {
		case 'custom-logo' :
		case 'custom-header' :
		case 'custom-background' :
			if ( isset( $_wp_theme_features[ $feature ][0][ $args[0] ] ) )
				return $_wp_theme_features[ $feature ][0][ $args[0] ];
			return false;
		default :
			return $_wp_theme_features[ $feature ];
	}
}
...
?>

其他

英文文档:https://developer.wordpress.org/reference/functions/get_theme_support/