現在のテーマのfunction.phpファイルに次のコードを貼り付けてください。
if (! function_exists('auto_custom_class_add_for_media_attchment')) :
function auto_custom_class_add_for_media_attchment($html, $id) {
$attachment = get_post($id);
$mime_type = $attachment->post_mime_type;
// Here i added if condition only for pdf mine type, you can use whatever mime_type you require or remove condition for all.
if ($mime_type == 'application/pdf') {
$src = wp_get_attachment_url($id);
$html = '<a class="fileuploadclass" href="'. $src .'">'. $attachment->post_title .'</a>';
}
return $html;
}
endif;
add_filter('media_send_to_editor', 'auto_custom_class_add_for_media_attchment', 20, 3);