Fix ‘The link you followed has expired’ (WordPress uploads)
If you encounter the error message “The link you followed has expired” when uploading media or themes in WordPress, it usually means your server’s PHP settings are too low to handle the upload. This guide provides a quick fix to resolve this issue by increasing the PHP limits that control upload size and script execution time.
Quick Fix
- Increase the
upload_max_filesize
andpost_max_size
values in your PHP configuration. - Increase the
max_execution_time
andmax_input_time
values to allow longer script processing. - Restart your web server or PHP service to apply changes.
Why this happens
This error occurs because WordPress relies on PHP settings to manage file uploads and script execution. When you upload a file that exceeds the limits set by upload_max_filesize
or post_max_size
, or if the upload process takes longer than max_execution_time
or max_input_time
, PHP stops the process and WordPress shows this error.
Common default PHP limits are often too low for larger media files or themes, especially on shared hosting environments. Adjusting these values allows WordPress to handle bigger uploads and longer processing times.
Step-by-step
1. Locate your PHP configuration file (php.ini)
Find the php.ini
file on your server. Its location depends on your hosting environment:
- On many Linux systems:
/etc/php/7.x/apache2/php.ini
or/etc/php/7.x/fpm/php.ini
- On cPanel servers: Use the MultiPHP INI Editor or check
public_html/php.ini
- On local setups: Check your PHP installation folder
2. Edit the php.ini file
Open the php.ini
file with a text editor and update or add the following lines:
upload_max_filesize = 64M
post_max_size = 64M
max_execution_time = 300
max_input_time = 300
memory_limit = 256M
Explanation:
upload_max_filesize
: Maximum allowed size for uploaded files.post_max_size
: Maximum size of POST data allowed.max_execution_time
: Maximum time in seconds a script is allowed to run.max_input_time
: Maximum time in seconds a script is allowed to parse input data.memory_limit
: Maximum amount of memory a script may consume.
3. Restart your web server or PHP service
After saving the changes, restart your web server or PHP service to apply the new settings.
- For Apache:
sudo systemctl restart apache2
sudo systemctl restart php7.x-fpm
sudo systemctl restart nginx
4. Verify changes
Create a phpinfo.php
file in your WordPress root directory with the following content:
<?php
phpinfo();
?>
Access it via your browser (e.g., https://yourdomain.com/phpinfo.php
) and confirm the new values for upload_max_filesize
, post_max_size
, max_execution_time
, and max_input_time
.
5. Remove the phpinfo.php file
For security reasons, delete the phpinfo.php
file after verification.
Alternative: Using .htaccess (Apache only)
If you cannot access the php.ini
file, you can try adding these lines to your WordPress root .htaccess
file:
php_value upload_max_filesize 64M
php_value post_max_size 64M
php_value max_execution_time 300
php_value max_input_time 300
php_value memory_limit 256M
Note: This method only works if your server allows overriding PHP settings via .htaccess
. It does not work on Nginx or LiteSpeed servers.
Works on
Server Type | Supported Method |
---|---|
Apache (cPanel, Plesk) | php.ini, .htaccess |
Nginx | php.ini (no .htaccess support) |
LiteSpeed | php.ini (may support .htaccess depending on configuration) |
Shared Hosting | php.ini (via control panel or MultiPHP INI Editor) |
FAQ
- Q1: I increased the limits but still get the error. What else can I try?
- Check your theme or plugin conflicts by disabling them temporarily. Also, verify your hosting provider does not enforce hard limits beyond your control.
- Q2: Can I increase these limits via wp-config.php?
- No, PHP upload and execution limits must be set in the server’s PHP configuration or .htaccess (Apache only). wp-config.php cannot modify these settings.
- Q3: What if I don’t have access to php.ini or .htaccess?
- Contact your hosting provider to increase the PHP limits or use their control panel tools like MultiPHP INI Editor.
- Q4: Is it safe to increase these limits?
- Yes, but avoid setting excessively high values as they can affect server performance or security. Use reasonable limits based on your needs.
- Q5: How do I know the current PHP upload limits?
- Create and access a
phpinfo.php
file with<?php phpinfo(); ?>
and look for <