Для тех, у кого есть тот же вопрос, здесь мое решение:
В wp-includes/functions.php
:
add_filter('wpcf7_validate_file*', 'cf7_custom_file_validation', 10, 2);
add_filter('wpcf7_validate_file', 'cf7_custom_file_validation', 10, 2);
function cf7_custom_file_validation ($result, $tag) {
if ($tag->name === 'file-586') {
$contentType = mime_content_type($_FILES[$tag->name]['tmp_name']);
if ($contentType !== 'image/png' && $contentType !== 'image/jpeg' && $contentType !== 'application/pdf') {
$result->invalidate($tag, 'Ce type de fichier n\'est pas supporté');
}
}
return $result;
}