wp_get_plugin_file_editable_extensions

函式
wp_get_plugin_file_editable_extensions ( $plugin )
引數
  • (string) $plugin Path to the plugin file relative to the plugins directory.
    Required:
返回值
  • (string[]) Array of editable file extensions.
定義位置
相關方法
wp_get_theme_file_editable_extensionswp_get_video_extensionswp_get_audio_extensionswp_make_plugin_file_treewp_get_installed_translations
引入
4.9.0
棄用
-

wp_get_plugin_file_editable_extensions: 這個函式返回一個可以在WordPress管理面板中編輯外掛的副檔名的陣列。

獲取外掛中可編輯的副檔名列表。

function wp_get_plugin_file_editable_extensions( $plugin ) {

	$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 plugin file editor.
	 *
	 * @since 2.8.0
	 * @since 4.9.0 Added the `$plugin` parameter.
	 *
	 * @param string[] $default_types An array of editable plugin file extensions.
	 * @param string   $plugin        Path to the plugin file relative to the plugins directory.
	 */
	$file_types = (array) apply_filters( 'editable_extensions', $default_types, $plugin );

	return $file_types;
}

常見問題

FAQs
檢視更多 >