$conf, $runtime; function_exists('chdir') AND chdir(APP_PATH); $r = 'mysql' == $conf['cache']['type'] ? website_set('runtime', $runtime) : cache_set('runtime', $runtime); } function runtime_truncate() { global $conf; 'mysql' == $conf['cache']['type'] ? website_set('runtime', '') : cache_delete('runtime'); } register_shutdown_function('runtime_save'); ?>themes - How to change allowed attachment files extensions|Programmer puzzle solving
最新消息:Welcome to the puzzle paradise for programmers! Here, a well-designed puzzle awaits you. From code logic puzzles to algorithmic challenges, each level is closely centered on the programmer's expertise and skills. Whether you're a novice programmer or an experienced tech guru, you'll find your own challenges on this site. In the process of solving puzzles, you can not only exercise your thinking skills, but also deepen your understanding and application of programming knowledge. Come to start this puzzle journey full of wisdom and challenges, with many programmers to compete with each other and show your programming wisdom! Translated with DeepL.com (free version)

themes - How to change allowed attachment files extensions

matteradmin10PV0评论

I have general question to group of WP themes that allow creating a classified ad websites.

I would like to know which file/part of code/function is responsible for restriction of attachments. These themes allows only images to be attached to the posted ad.

My aim is to expand allowed files format adding the 3d-model files (like .stl, .obj) that cant be execute on the server site and cannnot harm the server.

Thanks in advance

I have general question to group of WP themes that allow creating a classified ad websites.

I would like to know which file/part of code/function is responsible for restriction of attachments. These themes allows only images to be attached to the posted ad.

My aim is to expand allowed files format adding the 3d-model files (like .stl, .obj) that cant be execute on the server site and cannnot harm the server.

Thanks in advance

Share Improve this question asked Dec 18, 2018 at 7:24 SWESWE 11 bronze badge 2
  • You're going to need to ask their authors. They probably all do it in a different way. – Jacob Peattie Commented Dec 18, 2018 at 7:30
  • I have talked to one developer and he said that this group of themes have very similar function structure. I'm just new to Wordpress as well as i am very beginner at modifying code so i would like someone proficient to just show me the direct what i should looking for. – SWE Commented Dec 18, 2018 at 7:41
Add a comment  | 

1 Answer 1

Reset to default 0

I think this may be what your looking for. Below are a few examples of altering the default file types allowed by WordPress. Keep in mind that some hosting companies will disallow some file types.

Allow All File Types

Add the following to wp-config.php to allow for any file type.

define( 'ALLOW_UNFILTERED_UPLOADS', true );

Allow or Disable Specific Types

Add the following code into your theme's functions.php

function my_custom_mime_types( $mimes ) {

    // New allowed mime types.
    $mimes['svg'] = 'image/svg+xml';
    $mimes['svgz'] = 'image/svg+xml';
    $mimes['doc'] = 'application/msword'; 

    // Optional. Remove a mime type.
    unset( $mimes['exe'] );

    return $mimes;
}

add_filter( 'upload_mimes', 'my_custom_mime_types' );

Resources

Allowed mime Types

List of mime Types


Plugins

WP Add Mime Types

Disable Mime Check

Post a comment

comment list (0)

  1. No comments so far