wp_theme_editor_filetypes

Filters the list of file types allowed for editing in the Theme editor.

Description

apply_filters( 'wp_theme_editor_filetypes', (array) $default_types, (WP_Theme) $theme ); 

Parameters (2)

0. $default_types (array)
List of file types. Default types include php and css..
1. $theme (WP_Theme)
The current Theme object.

Usage

To run the hook, copy the example below.
  1. $default_types = apply_filters( 'wp_theme_editor_filetypes', $default_types, $theme ); 
  2.  
  3. if ( !empty( $default_types ) ) { 
  4.  
  5. // everything has led up to this point... 
  6.  
  7.  
The following example is for adding a hook callback.
  1. // define the wp_theme_editor_filetypes callback 
  2. function filter_wp_theme_editor_filetypes( $default_types, $theme ) { 
  3. // make filter magic happen here... 
  4. return $default_types
  5. }; 
  6.  
  7. // add the filter 
  8. add_filter( 'wp_theme_editor_filetypes', 'filter_wp_theme_editor_filetypes', 10, 2 ); 
To remove a hook callback, use the example below.
  1. // remove the filter 
  2. remove_filter( 'wp_theme_editor_filetypes', 'filter_wp_theme_editor_filetypes', 10, 2 ); 

Defined (1)

The filter is defined in the following location(s).

/wp-admin/theme-editor.php  
  1. $file_types = apply_filters( 'wp_theme_editor_filetypes', $default_types, $theme );