I’m working on a multisite WP installation and I need to import content from other WordPress sites (.wxr files). When I use the Import WordPress plugin I got the following:

enter image description here

The maximum allowed upload size is only 1MB, while I set 100MB in my php.ini. A call to phpinfo() tells that the .ini values should apply:

enter image description here

What is wrong there? I read through most of the search results for upload_max_filesize on this site, but none works.

Note: This only happens with WordPress. I have Symfony2 sites and I can upload files with 100MB size and more – so yes, it’s the right php.ini settings and the Apache server properly applies them.

Writing MU WordPress Plugin

After @kaiser suggestion I’ve created a /wp-content/mu-plugins/uploadSizeLimit.php file and wrote this on it:

/** Plugin Name: (WPSE) #177620 Alter Upload Size Limit */
add_filter(
    'upload_size_limit',
    function ( $limit = 0, $u_bytes = 0, $p_bytes = 0 ) {
        return 
               current_user_can( 'manage_options' ) 
               ? 1024 * 1024 * 10 // Divert by 1024 to get the value in kB
               : $limit;
    }
);

How do I use this to achieve what I need?

2 Answers
2

Thanks @kaiser but not need to go through your solution I found a easy one and I’ll share here for newbie likes me.

If you’re working on a WP Network site then the steps are:

  1. At the top, hover over My Sites and then click Network Admin.
  2. At the left, hover over Settings and then click Network Settings.
  3. Scroll to the bottom of the page and change the Max upload file size to whatever you would like in KB.
  4. Click Save Changes.

By setting that value to 500000 I got 500M as max_file_size upload. Credits is for user here

Leave a Reply

Your email address will not be published. Required fields are marked *