функция
since 3.1.0
get_theme_support()
Проверено на WordPress 6.9, обновлено Источник: WordPress Developer Resources.
Сигнатура
get_theme_support( string $feature, mixed $args ): mixed
Описание
Пример использования:
get_theme_support( 'custom-logo' );
get_theme_support( 'custom-header', 'width' );
Оригинал (английский)
Example usage:
get_theme_support( 'custom-logo' );
get_theme_support( 'custom-header', 'width' );
Параметры
$feature
string
обязательный
Возможность для проверки. Список возможных значений см. в add_theme_support().
$args
mixed
необязательный
Необязательные дополнительные аргументы для проверки применительно к определённым возможностям.
Возвращаемое значение
mixed
Исходный код
wp-includes/theme.php:3031
function get_theme_support( $feature, ...$args ) {
global $_wp_theme_features;
if ( ! isset( $_wp_theme_features[ $feature ] ) ) {
return false;
}
if ( ! $args ) {
return $_wp_theme_features[ $feature ];
}
switch ( $feature ) {
case 'custom-logo':
case 'custom-header':
case 'custom-background':
return $_wp_theme_features[ $feature ][0][ $args[0] ] ?? false;
default:
return $_wp_theme_features[ $feature ];
}
}
История изменений
| Версия | Описание |
|---|---|
| 5.3.0 | Formalized the existing and already documented ...$args parameter by adding it to the function signature. |
| 3.1.0 | Introduced. |

