wp_get_ext_types

Retrieves the list of common file extensions and their types.

Description

(array) wp_get_ext_types(); 

Returns (array)

Array of file extensions types keyed by the type of file.


Usage

  1. if ( !function_exists( 'wp_get_ext_types' ) ) { 
  2. require_once ABSPATH . WPINC . '/functions.php'; 
  3.  
  4.  
  5. // NOTICE! Understand what this does before running. 
  6. $result = wp_get_ext_types(); 
  7.  

Defined (1)

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

/wp-includes/functions.php  
  1. function wp_get_ext_types() { 
  2.  
  3. /** 
  4. * Filters file type based on the extension name. 
  5. * @since 2.5.0 
  6. * @see wp_ext2type() 
  7. * @param array $ext2type Multi-dimensional array with extensions for a default set 
  8. * of file types. 
  9. */ 
  10. return apply_filters( 'ext2type', array( 
  11. 'image' => array( 'jpg', 'jpeg', 'jpe', 'gif', 'png', 'bmp', 'tif', 'tiff', 'ico' ),  
  12. 'audio' => array( 'aac', 'ac3', 'aif', 'aiff', 'm3a', 'm4a', 'm4b', 'mka', 'mp1', 'mp2', 'mp3', 'ogg', 'oga', 'ram', 'wav', 'wma' ),  
  13. 'video' => array( '3g2', '3gp', '3gpp', 'asf', 'avi', 'divx', 'dv', 'flv', 'm4v', 'mkv', 'mov', 'mp4', 'mpeg', 'mpg', 'mpv', 'ogm', 'ogv', 'qt', 'rm', 'vob', 'wmv' ),  
  14. 'document' => array( 'doc', 'docx', 'docm', 'dotm', 'odt', 'pages', 'pdf', 'xps', 'oxps', 'rtf', wp, 'wpd', 'psd', 'xcf' ),  
  15. 'spreadsheet' => array( 'numbers', 'ods', 'xls', 'xlsx', 'xlsm', 'xlsb' ),  
  16. 'interactive' => array( 'swf', 'key', 'ppt', 'pptx', 'pptm', 'pps', 'ppsx', 'ppsm', 'sldx', 'sldm', 'odp' ),  
  17. 'text' => array( 'asc', 'csv', 'tsv', 'txt' ),  
  18. 'archive' => array( 'bz2', 'cab', 'dmg', 'gz', 'rar', 'sea', 'sit', 'sqx', 'tar', 'tgz', 'zip', '7z' ),  
  19. 'code' => array( 'css', 'htm', 'html', 'php', 'js' ),  
  20. ) );