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:
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:
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?