WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

By default, I have a 2m limit of uploads. I want to decrease this number. I found out that this code:

function custom_file_max_upload_size( $file ) {
    $size = $file['size'];
    if ( $size > 1000 * 1024 ) { 
           $file['error'] = __( 'ERROR: you cannot upload files larger than 1M', 'textdomain' ); 

    return $file;
add_filter ( 'wp_handle_upload_prefilter', 'custom_file_max_upload_size', 10, 1 );

works by adding to functions. However, it does not update the upload size information when the user is on upload screen. It still displays Maximum upload file size: 2MB. How can I change that text to 1mb? Or alternatively, a different approach to decrease the file size (that does not include editing php.ini or htaccess...)

share|improve this question
up vote 5 down vote accepted

That number is taken from wp_max_upload_size(), and there is a filter: 'upload_size_limit'. See wp-admin/includes/template.php.

So this should work (not tested):

add_filter( 'upload_size_limit', 'wpse_70754_change_upload_size' );

function wpse_70754_change_upload_size()
    return 1000 * 1024;
share|improve this answer
Works fine, thank you. – Amanda Bynes Oct 28 '12 at 15:35

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.