WordPress usually displays “The link you followed has expired” when a theme or plugin ZIP exceeds your server’s PHP upload limits. The quickest fix is to raise those limits through your hosting panel, then retry from a freshly opened upload screen.
However, the WordPress link expired error can also indicate an expired security token or another hosting restriction. Start with the effective server settings so you don’t change files unnecessarily.
Key takeaways
- Compare the ZIP size against your live PHP limits before changing anything.
- Prefer hosting-panel settings over code snippets, which can’t override every restriction.
- Back up your files and database before editing configuration, then test one change at a time.
1. Diagnose the WordPress link expired error
Compare the file size with your limits
Open Tools > Site Health > Info > Server. Record the upload size, POST size, execution time and PHP version. Documentation for this diagnostic screen explains how to use it.
Also visit Media > Add New to check the effective maximum upload file size. Some shared hosting configurations allow only 2 MB or 8 MB, which can block modern theme packages.
Check that you’re uploading the installable ZIP, not a download bundle containing documentation and other files.

Understand which setting blocks the upload
upload_max_filesize limits the size of one file. post_max_size limits the complete request, so it must equal or exceed the individual file limit. Meanwhile, max_execution_time limits how long PHP runs.
A smaller POST limit can stop WordPress receiving the upload and its security token correctly, producing the misleading expiry message.
If the file fits within the limits, sign in again and reopen the upload screen. Don’t retry through an old browser tab. A genuinely expired security token needs a fresh request, not higher limits.
2. Increase PHP limits through your hosting configuration
Start with the hosting panel
Look for PHP Options, PHP Settings or cPanel’s MultiPHP INI Editor. These controls change the server configuration without touching your theme.
Set upload_max_filesize to 128M, post_max_size to 128M, and max_execution_time to 300. These values allow larger packages and up to 300 seconds of PHP execution, subject to hosting restrictions.
Because POST requests include extra data, use 160M for post_max_size when uploading files close to 128 MB. Avoid unlimited settings.
Save your changes, open a fresh upload screen and retry the same ZIP.
Use php.ini when your hosting supports it
Download a backup before editing the active php.ini configuration. Add or update:
upload_max_filesize = 128M
post_max_size = 128M
max_execution_time = 300
If your host supports per-directory settings, create or edit a php.ini file in the WordPress root. The root contains wp-admin and wp-content.
PHP-FPM hosting may use .user.ini instead. An unsupported root-level php.ini does nothing.
Allow any configuration refresh interval, then inspect Site Health again. Unchanged live values mean the override hasn’t taken effect.
3. Use .htaccess only with a compatible Apache setup
The .htaccess approach works with Apache configurations that permit PHP directives through its PHP module. It isn’t suitable for every Apache site.
After making a full site backup, open the root .htaccess file through File Manager or SFTP. Enable hidden-file visibility if necessary.
Place these lines outside WordPress’s generated rule block:
php_value upload_max_filesize 128M
php_value post_max_size 128M
php_value max_execution_time 300
php_value max_input_time 300
max_input_time controls the time allowed for parsing input. It doesn’t replace the execution-time setting.
Then verify the effective limits and retry the upload. If the site immediately returns a 500 error, remove the added lines or restore your saved file. Our WordPress 500 error guide covers further investigation.
Nginx doesn’t use .htaccess. PHP-FPM and FastCGI setups generally need hosting-panel settings or another supported PHP configuration method.
4. Understand the WPCode and functions.php limitations
Why the common ini_set snippet disappoints
You may encounter advice to add this through WPCode as a PHP snippet or inside a child theme’s functions.php:
@ini_set( 'upload_max_filesize', '128M' );
@ini_set( 'post_max_size', '128M' );
@ini_set( 'memory_limit', '256M' );
@ini_set( 'max_execution_time', '300' );
However, upload_max_filesize and post_max_size aren’t runtime-changeable with ini_set. PHP processes the incoming upload before WordPress runs this code in WPCode or functions.php, so it can’t rescue an oversized request. The Theme Editor can’t change upload directives after PHP has handled the incoming request.
The memory and execution-time lines may work where hosting policy permits them.
Avoid hiding configuration failures
The @ prefix suppresses some diagnostics, but it doesn’t override hosting policy. It also can’t reliably protect a snippet when the host has disabled ini_set.
Don’t add this snippet merely to increase upload size. Prefer the hosting panel or a supported configuration file.
If you use runtime code for a justified memory or timeout adjustment, verify the live settings afterwards and repeat the failing action. Use WPCode or a child theme rather than editing a parent theme, where updates can overwrite changes.
5. Investigate memory and PHP compatibility separately
Raise memory only when logs justify it
A memory exhausted error in the logs points to a different resource limit. Back up wp-config.php, then edit an existing definition or add:
define( 'WP_MEMORY_LIMIT', '256M' );
Place it before the comment containing “That’s all, stop editing! Happy publishing.”
Don’t duplicate an existing definition. A lower hosting-enforced ceiling still takes precedence.
WordPress’s PHP configuration guidance covers these server-level controls. After changing memory, inspect the effective value and repeat the request that failed.
Test a supported PHP version
Outdated PHP can cause PHP incompatibility with plugins or themes. Use staging to test a supported release that’s compatible with your installed software, with a rollback ready.
Use the hosting panel to change PHP; the diagnostic screen only reports the active version. Then repeat the upload and inspect matching log entries.
Similarly, increasing execution time won’t repair incompatible code or a blocked connection. Treat timeout settings as a response to evidence, rather than a universal fix.
6. Install through SFTP or File Manager when necessary
If dashboard access is unavailable, use your hosting File Manager or SFTP. SFTP is encrypted, unlike standard FTP, and both tools can restore configuration backups.
The Theme Editor can’t install a package or restore configuration files when you can’t access the dashboard.
For a trusted plugin upload or theme upload:
- Extract the ZIP locally and identify the actual plugin or theme folder.
- Upload it into
wp-content/plugins/orwp-content/themes/, without overwriting an existing installation blindly. - Once dashboard access returns, activate it through Plugins or Appearance, then test.
This bypasses browser upload limits but doesn’t repair the underlying configuration.
Uploading photographs directly by SFTP also doesn’t automatically register them in the Media Library. Use this installation workaround for themes and plugins, not as a general media-upload replacement.
7. If the error persists, isolate conflicts and server restrictions
Test plugins without deleting their data
On staging, record active plugins, then deactivate plugins in bulk under Plugins > Installed Plugins and repeat the upload. If it succeeds, reactivate plugins individually and retest until the error returns. This can identify a plugin conflict.
Disconnect staging from email marketing and lead-generation automations so tests don’t contact real clients.
Without dashboard access, rename wp-content/plugins to plugins.hold through SFTP. Visit the Plugins screen whilst the folder is renamed, then restore its name and reactivate plugins individually. Must-use plugins and hosting drop-ins need separate investigation.
If plugins aren’t responsible, test an installed default theme on staging. Theme switching can affect web design and digital branding.
Escalate unchanged limits with useful evidence

Managed hosting may block overrides. Nginx’s client_max_body_size, a reverse proxy or a firewall can impose another limit. A 413 Request Entity Too Large response points to a request-size restriction.
Send hosting support the exact error, timestamp, ZIP size, Site Health values, sanitised log excerpt and changes attempted. Ask your hosting provider to check effective web-PHP settings, request-size limits, disk and inode quotas, ownership and permissions. Never apply 777 permissions as a shortcut.
Our managed versus shared hosting comparison explains differences in support responsibilities.
Frequently asked questions
Why does a small image upload but a large one fail?
The larger file may exceed an upload limit or need more processing memory. Compare both file size and pixel dimensions.
If it already appears in the Media Library after an error, inspect the attachment before uploading duplicates. Thumbnail generation may have failed after the original upload succeeded.
Why must post_max_size match or exceed upload_max_filesize?
PHP must accept the complete request before WordPress can process its file. A smaller POST allowance blocks that request even when the file fits the individual upload limit.
WordPress’s upload-limit health check detects mismatched settings. Leave extra POST headroom for files near the upload ceiling.
Restore uploads with the smallest effective change
The reliable fix is to identify the active restriction, change it through a supported method, and repeat the original upload. Live values and a successful retry matter more than a saved snippet.
Afterwards, remove unsuccessful changes and test affected forms and mobile-responsive pages. Include these checks in website care and maintenance.
If your agency needs technical support for client websites, See how we collaborate with creative agencies.