← Back to All Snippets

How to Properly Increase Maximum Upload File Size in WordPress

⚡ Target: .htaccess / .user.ini 🔒 Tested: WP 6.6+ / PHP 8.2+ 💻 Lang: APACHE
APACHE (.htaccess / .user.ini)
# Add to .htaccess (Apache / LiteSpeed)
php_value upload_max_filesize 64M
php_value post_max_size 64M
php_value max_execution_time 300
php_value max_input_time 300

# Or add to .user.ini (Nginx / PHP-FPM / cPanel MultiPHP)
# upload_max_filesize = 64M
# post_max_size = 64M
# max_execution_time = 300

Important Technical Note: In PHP, upload_max_filesize and post_max_size are PHP_INI_PERDIR directives. Calling @ini_set() inside functions.php or wp-config.php is ineffective on modern FastCGI/PHP-FPM servers because the HTTP payload is evaluated before theme execution starts.

To reliably increase your WordPress upload file size, place these directives in your .htaccess (Apache/LiteSpeed) or .user.ini (Nginx/PHP-FPM), and adjust WP_MEMORY_LIMIT in wp-config.php.

← Back to All Snippets Explore Dev Tools →