editable_extensions
Filters the list of file types allowed for editing in the plugin file editor.
Usage
add_filter( 'editable_extensions', 'wp_kama_editable_extensions_filter', 10, 2 );
/**
* Function for `editable_extensions` filter-hook.
*
* @param string[] $default_types An array of editable plugin file extensions.
* @param string $plugin Path to the plugin file relative to the plugins directory.
*
* @return string[]
*/
function wp_kama_editable_extensions_filter( $default_types, $plugin ){
// filter...
return $default_types;
}
- $default_types(string[])
- An array of editable plugin file extensions.
- $plugin(string)
- Path to the plugin file relative to the plugins directory.
Changelog
| Since 2.8.0 | Introduced. |
| Since 4.9.0 | Added the $plugin parameter. |
Where the hook is called
editable_extensions
wp-admin/includes/file.php 239
$file_types = (array) apply_filters( 'editable_extensions', $default_types, $plugin );