Skip to content

Commit

Permalink
debugging #1
Browse files Browse the repository at this point in the history
  • Loading branch information
d4mation committed Nov 29, 2018
1 parent 1f1a406 commit 23e6f99
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,10 @@

} );

add_action( 'admin_init', function() {
var_dump( check_upload_mimes( array( 'xlsx' => 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet' ) ) );
});

/**
* Setup theme properties and stuff
*
Expand All @@ -126,4 +130,23 @@
// Allow shortcodes in text widget
add_filter( 'widget_text', 'do_shortcode' );

} );

/**
* Allow CSV and Excel Files to be uploaded by Admins
* @param array Mime Types
* @return array Modified Mime Types
*/
add_filter( 'upload_mimes', function( $mime_types ) {

//if ( ! current_user_can( 'manage_options' ) ) return $mime_types;

$mime_types = array_merge( $mime_types, array(
'xls' => 'application/vnd.ms-excel',
'xlsx' => 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet',
'csv' => 'text/csv',
) );

return $mime_types;

} );

0 comments on commit 23e6f99

Please sign in to comment.