1. Home
  2. Knowledge Base
  3. WooCommerce Product Add-Ons Ultimate
  4. Field Types
  5. File Uploads
  6. Change upload field messages
  1. Home
  2. Knowledge Base
  3. WooCommerce Product Add-Ons Ultimate
  4. Product Page
  5. Change upload field messages

Change upload field messages

You can filter all the messages on the AJAX file upload field, e.g. “Drop files here to upload”, using the following snippets:

<?php
/**
* Change the 'Drop files here to upload' message
*/
function tester_dictDefaultMessage_message( $message ) {
return 'Your message';
}
add_filter( 'pewc_filter_dictDefaultMessage_message', 'tester_dictDefaultMessage_message' );
/**
* Change the 'Your browser does not support drag and drop file uploads' message
*/
function tester_dictFallbackMessage_message( $message ) {
return 'Your message';
}
add_filter( 'pewc_filter_dictFallbackMessage_message', 'tester_dictFallbackMessage_message' );
/**
* Change the 'Please use the fallback form below to upload your files like in the olden days' message
*/
function tester_dictFallbackText_message( $message ) {
return 'Your message';
}
add_filter( 'pewc_filter_dictFallbackText_message', 'tester_dictFallbackText_message' );
/**
* Change the 'The file is too big' message
*/
function tester_dictFileTooBig_message( $message ) {
return 'Your message';
}
add_filter( 'pewc_filter_dictFileTooBig_message', 'tester_dictFileTooBig_message' );
/**
* Change the 'You cannot upload files of this type' message
*/
function tester_dictInvalidFileType_message( $message ) {
return 'Your message';
}
add_filter( 'pewc_filter_dictInvalidFileType_message', 'tester_dictInvalidFileType_message' );
/**
* Change the 'Cancel upload' message
*/
function tester_dictCancelUpload_message( $message ) {
return 'Your message';
}
add_filter( 'pewc_filter_dictCancelUpload_message', 'tester_dictCancelUpload_message' );
/**
* Change the 'Upload cancelled' message
*/
function tester_dictUploadCanceled_message( $message ) {
return 'Your message';
}
add_filter( 'pewc_filter_dictUploadCanceled_message', 'tester_dictUploadCanceled_message' );
/**
* Change the 'Are you sure you want to cancel this upload?' message
*/
function tester_dictCancelUploadConfirmation_message( $message ) {
return 'Your message';
}
add_filter( 'pewc_filter_dictCancelUploadConfirmation_message', 'tester_dictCancelUploadConfirmation_message' );
/**
* Change the 'Remove file' message
*/
function tester_dictRemoveFile_message( $message ) {
return 'Your message';
}
add_filter( 'pewc_filter_dictRemoveFile_message', 'tester_dictRemoveFile_message' );
/**
* Change the 'You cannot upload any more files' message
*/
function tester_dictMaxFilesExceeded_message( $message ) {
return 'Your message';
}
add_filter( 'pewc_filter_dictMaxFilesExceeded_message', 'tester_dictMaxFilesExceeded_message' );

You can add snippets to your site by following these steps.

Was this article helpful?

Related Articles