This article describes the WordPress only support upload images of the real Now the method, using the custom function to implement the image upload function, do not allow other files to upload, the need for a friend reference. !--ad-->!--ad--end--> WordPress support uploading pictures When adding an article, WordPress supports adding media, including pictures, videos, Various multimedia files such as Word and Excel. Get all the file types that WordPress supports to upload, and insert the following PHP code in the functions.php of the current topic. Then, open the blog home page, view the source code, you can see a complete support list (bbs.it-home.org Script Academy): Print_r (Wp_get_mime_types ()); How to let WordPress only support uploading image files, other files are refused to upload. The is inserted in the functions.php of the current topic: //Add the Filteradd_filter (' Upload_ Mimes ', ' custom_upload_mimes '); function custom_upload_mimes ($existing _mimes=array ()) {$existing _mimes = array (' Jpg| Jpeg|jpe ' = ' image/jpeg ', ' gif ' = ' image/gif ', ' png ' = ' image/png ', ' bmp ' = ' image/bmp ', ' tif| ' Tiff ' = ' image/tiff ', ' ico ' = ' image/x-icon '); return $existing _mimes; The can only support uploading pictures, rejecting other file uploads. |