wp_get_theme_file_editable_extensions

The timeline below displays how wordpress function wp_get_theme_file_editable_extensions has changed across different WordPress versions. If a version is not listed, refer to the next available version below.

WordPress Version: 6.1

/**
 * Gets the list of file extensions that are editable for a given theme.
 *
 * @since 4.9.0
 *
 * @param WP_Theme $theme Theme object.
 * @return string[] Array of editable file extensions.
 */
function wp_get_theme_file_editable_extensions($theme)
{
    $default_types = array('bash', 'conf', 'css', 'diff', 'htm', 'html', 'http', 'inc', 'include', 'js', '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));
}

WordPress Version: 5.9

/**
 * Gets the list of file extensions that are editable for a given theme.
 *
 * @since 4.9.0
 *
 * @param WP_Theme $theme Theme object.
 * @return string[] Array of editable file extensions.
 */
function wp_get_theme_file_editable_extensions($theme)
{
    $default_types = array('bash', 'conf', 'css', 'diff', 'htm', 'html', 'http', 'inc', 'include', 'js', '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 current 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));
}

WordPress Version: 5.5

/**
 * Gets the list of file extensions that are editable for a given theme.
 *
 * @since 4.9.0
 *
 * @param WP_Theme $theme Theme object.
 * @return string[] Array of editable file extensions.
 */
function wp_get_theme_file_editable_extensions($theme)
{
    $default_types = array('bash', 'conf', 'css', 'diff', 'htm', 'html', 'http', 'inc', 'include', 'js', '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 editor.
     *
     * @since 4.4.0
     *
     * @param string[] $default_types An array of editable theme file extensions.
     * @param WP_Theme $theme         The current 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));
}

WordPress Version: 5.1

/**
 * Get list of file extensions that are editable for a given theme.
 *
 * @param WP_Theme $theme Theme object.
 * @return string[] Array of editable file extensions.
 */
function wp_get_theme_file_editable_extensions($theme)
{
    $default_types = array('bash', 'conf', 'css', 'diff', 'htm', 'html', 'http', 'inc', 'include', 'js', '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 editor.
     *
     * @since 4.4.0
     *
     * @param string[] $default_types List of allowed file types.
     * @param WP_Theme $theme         The current 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));
}

WordPress Version: 4.9

/**
 * Get list of file extensions that are editable for a given theme.
 *
 * @param WP_Theme $theme Theme.
 * @return array File extensions.
 */
function wp_get_theme_file_editable_extensions($theme)
{
    $default_types = array('bash', 'conf', 'css', 'diff', 'htm', 'html', 'http', 'inc', 'include', 'js', '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 editor.
     *
     * @since 4.4.0
     *
     * @param array    $default_types List of file types. Default types include 'php' and 'css'.
     * @param WP_Theme $theme         The current 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));
}