Make WordPress Core

Opened 2 months ago

Closed 2 months ago

#65057 closed feature request (wontfix)

For our use of WordPresswe need to be able to upload and manage .dwg and .dwt files

Reported by: ahjelmqv's profile ahjelmqv Owned by:
Milestone: Priority: normal
Severity: normal Version:
Component: Upload Keywords:
Focuses: Cc:

Description (last modified by dd32)

To be able to upload tech drawings, I appended two rows in wp/wp-includes/functions.php to allow .dwg and .dwt files to be recognized and allowed.
Would be nice to have them included in core if there is no risks with allowing.

# within file     wp/wp-includes/functions.php


function wp_get_mime_types() {

        return apply_filters(
                'mime_types',
                array(
...
                        'dwg'                          => 'image/vnd.dwg',
                        'dwt'                          => 'application/x-autocad',
...

                )
        );
}

Change History (2)

#1 @dd32
2 months ago

  • Component changed from General to Upload
  • Description modified (diff)

Hi @ahjelmqv,

Generally use of a plugin to enable less-common file mime types is best, as not every file type can be included in WordPress.

In general, use of a plugin to enable site-specific mime-types is the best route for most people.

#2 @audrasjb
2 months ago

  • Milestone Awaiting Review deleted
  • Resolution set to wontfix
  • Status changed from new to closed
  • Version 6.9.4 deleted

Hello and thanks for the ticket,

This is indeed plugin territory. You should be able to find some plugins that allow full customization on which files are allowed or not, but you can also use the following code, either in a custom plugin or in your theme's functions.php file (make sure you create a child theme first).

/**
 * Add dwg and dwt to allowed media types
 */
function ahjelmqv_add_mime_types( $mime_types ) {
	$mime_types['dwg'] = 'image/vnd.dwg';
	$mime_types['dwt'] = 'application/x-autocad';
	return $mime_types;
}

add_filter( 'mime_types', 'ahjelmqv_add_mime_types' );

I'm closing this ticket as wontfix as it is plugin territory.

Note: See TracTickets for help on using tickets.