функция
since 4.9.0
wp_get_theme_file_editable_extensions()
Проверено на WordPress 6.9, обновлено Источник: WordPress Developer Resources.
Сигнатура
wp_get_theme_file_editable_extensions( WP_Theme $theme ): string[]
Описание
Получает список расширений файлов, которые можно редактировать для указанной темы.
Параметры
$theme
WP_Theme
обязательный
Объект темы.
Возвращаемое значение
string[]
Исходный код
wp-admin/includes/file.php:252
function wp_get_theme_file_editable_extensions( $theme ) {
$default_types = array(
'bash',
'conf',
'css',
'diff',
'htm',
'html',
'http',
'inc',
'include',
'js',
'mjs',
'json',
'jsx',
'less',
'md',
'patch',
'php',
'php3',
'php4',
'php5',
'php7',
'phps',
'phtml',
'sass',
'scss',
'sh',
'sql',
'svg',
'text',
'txt',
'xml',
'yaml',
'yml',
);
/**
* Filters the list of file types allowed for editing in the theme file editor.
*
* @since 4.4.0
*
* @param string[] $default_types An array of editable theme file extensions.
* @param WP_Theme $theme The active theme object.
*/
$file_types = apply_filters( 'wp_theme_editor_filetypes', $default_types, $theme );
// Ensure that default types are still there.
return array_unique( array_merge( $file_types, $default_types ) );
}
История изменений
| Версия | Описание |
|---|---|
| 4.9.0 | Introduced. |

