wp_theme_editor_filetypes
Filter HookDescription
Filters the list of file types allowed for editing in the theme file editor.Hook Information
File Location |
wp-admin/includes/file.php
View on GitHub
|
Hook Type | Filter |
Line Number | 296 |
Hook Parameters
Type | Name | Description |
---|---|---|
string[]
|
$default_types
|
An array of editable theme file extensions. |
WP_Theme
|
$theme
|
The active theme object. |
Usage Examples
Basic Usage
<?php
// Hook into wp_theme_editor_filetypes
add_filter('wp_theme_editor_filetypes', 'my_custom_filter', 10, 2);
function my_custom_filter($default_types, $theme) {
// Your custom filtering logic here
return $default_types;
}
Source Code Context
wp-admin/includes/file.php:296
- How this hook is used in WordPress core
<?php
291 * @since 4.4.0
292 *
293 * @param string[] $default_types An array of editable theme file extensions.
294 * @param WP_Theme $theme The active theme object.
295 */
296 $file_types = apply_filters( 'wp_theme_editor_filetypes', $default_types, $theme );
297
298 // Ensure that default types are still there.
299 return array_unique( array_merge( $file_types, $default_types ) );
300 }
301
PHP Documentation
<?php
/**
* 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.
*/
Quick Info
- Hook Type: Filter
- Parameters: 2
- File: wp-admin/includes/file.php
Related Hooks
Related hooks will be displayed here in future updates.