Trusted WordPress tutorials, when you need them most.
Beginner’s Guide to WordPress
WPB Cup
25 Million+
Websites using our plugins
16+
Years of WordPress experience
3000+
WordPress tutorials
by experts

How to Fix “The Link You Followed Has Expired” Error in WordPress

It’s incredibly frustrating when you try to upload a new theme or plugin, only to be stopped by the error: ‘The link you followed has expired.’ The message gives no clue what went wrong, leaving you completely stuck.

Don’t worry, this is a common issue with a straightforward fix. It’s usually caused by a server setting that limits the size of files you can upload, and it’s easy to change.

In this guide, we’ll walk you through several simple methods to solve this problem for good. You’ll be back to uploading your files in just a few minutes.

Fixing 'The link you have followed has expired' error

This error usually happens when you try to upload a theme or plugin file that’s larger than WordPress is allowed to handle. Your WordPress hosting company sets these limits to keep your website running smoothly.

If a file is too big, it can make your website slow or even unstable. Here’s what the error message typically looks like on your screen.

The link you followed has expired error displayed on a WordPress website

You can sometimes see your site’s current upload limit on the Media » Add New page. However, a better way to see all the relevant server settings is by using the built-in Site Health tool.

Just go to Tools » Site Health, click on the ‘Info’ tab, and open the ‘Server’ section. Here you can see the exact values for upload_max_filesize, post_max_size, and other limits. This helps you confirm if the server limits are the cause of the problem.

WordPress file upload limit

When these limits are too low for the file you’re uploading, WordPress can run out of resources. This can also trigger other issues, like the memory exhausted error or the maximum execution time exceeded error.

Now, let’s look at how to easily fix this problem.

To fix ‘The link you followed has expired,’ the main solution is to increase your site’s file upload size and execution time limits. We’ll also cover increasing the PHP memory limit, which is a separate step that can solve related errors.

The first few methods we’ll cover are different ways to fix the main issue with server limits. If those don’t solve the problem, the later methods will help you check for other possible causes, like plugin conflicts.

Keep in mind that some web hosts may restrict your ability to change these settings. If one method doesn’t work, don’t get discouraged. Just move on to the next one in the list.

The safest and easiest way to increase the limits is by using the free WPCode plugin. It lets you add custom code to WordPress without editing your theme’s files.

This is the method we recommend because it protects your changes from being erased when you update your theme. We use WPCode across our own websites to manage important code snippets safely.

First, you need to install and activate WPCode. For details, see our step-by-step guide on how to install a WordPress plugin.

Once activated, go to Code Snippets » Add Snippet from your WordPress admin panel. Then, find the ‘Add Your Custom Code (New Snippet)’ option and click the ‘Use snippet’ button.

Adding Custom Code in WPCode

On the next screen, give your snippet a title so you can easily identify it later.

From the ‘Code Type’ dropdown menu, make sure to select ‘PHP Snippet’.

Select PHP Snippet as the code type

Now, copy and paste the following code into the ‘Code Preview’ box:

@ini_set( 'upload_max_filesize' , '128M' );
@ini_set( 'post_max_size', '128M');
@ini_set( 'memory_limit', '256M' );
@ini_set( 'max_execution_time', '300' );

A quick tip: the post_max_size value should always be the same as or larger than the upload_max_filesize. Think of it as a box (post_max_size) that needs to be big enough to hold your file (upload_max_filesize).

This code uses the ini_set function, which is a standard PHP command for changing a server setting. We add the @ symbol at the beginning of each line to prevent any errors from showing on your site if your host has disabled this function.

This code also increases the file upload size to 128 megabytes and the execution time to 300 seconds. You can adjust these numbers to be larger than the file you are trying to upload.

Finally, toggle the switch at the top to ‘Active’ and click the ‘Save Snippet’ button.

Activate and save snippet in WPCode

For more details, you can see our complete review of WPCode and how it helps you safely add custom code in WordPress.

Method 2: Increase Limits in the .htaccess File

🚨 Heads Up: This method is for advanced users and involves editing a core server file. We strongly recommend creating a full backup of your site first, as a mistake could cause an internal server error.

Another way to increase your PHP resource limits is by editing the .htaccess file. Please note, this method only works for web servers running Apache.

You can find the .htaccess file in your site’s root folder using FTP or a file manager. Open the file to edit it.

Editing the .htaccess file using FTP

Now, add the following lines of code at the very bottom of your .htaccess file:

php_value upload_max_filesize 128M
php_value post_max_size 128M
php_value max_execution_time 300
php_value max_input_time 300

Don’t forget to save your changes and upload the file back to your server.

Please note, this method works on web servers running Apache. Many hosts using LiteSpeed also support .htaccess rules, but users on Nginx servers will likely need to contact their hosting provider for help.

Method 3: Increase Limits in the php.ini File

🚨 Heads Up: This is another advanced method that involves server configuration files. Please back up your website before making any changes to prevent potential issues.

The php.ini file is a special configuration file used by PHP. You can look for it in your site’s root directory using an FTP client.

If you are on a shared hosting plan, you might not find this file. In that case, you can create a blank file named php.ini using a text editor, and then upload it to your site’s root folder.

Now, edit the php.ini file and add the following code inside it:

upload_max_filesize = 128M
post_max_size = 128M
max_execution_time = 300

Save your changes and upload the file back to your website. You can now try uploading your theme or plugin file again. The error should be gone.

Method 4: Check for Plugin Conflicts

In some cases, the ‘The link you followed has expired’ error can be caused by a conflict between your WordPress plugins. Sometimes, a plugin can interfere with the file upload process, which causes this error.

To check if this is the problem, you can temporarily deactivate all your plugins and then reactivate them one by one.

First, go to the Plugins page in your WordPress dashboard. Select all plugins, choose ‘Deactivate’ from the bulk actions dropdown menu, and then click ‘Apply.’

Bulk deactivate all WordPress plugins

Next, try uploading the file again.

If the error is gone, you know a plugin was causing the conflict. Now, reactivate each plugin one at a time, trying the upload after each one, until the error comes back.

Method 5: Update Your PHP Version

Sometimes, an outdated PHP version can cause compatibility issues that lead to this error. Updating your site to a newer version of PHP can often be a quick fix.

To do this safely, you can follow our complete guide on how to update your PHP version in WordPress.

Method 6: Increase PHP Memory Limit in wp-config.php

🚨 Heads Up: This method involves editing a core WordPress file. We strongly recommend creating a full backup of your site before you proceed. One small mistake could break your website.

This method doesn’t directly fix the file size limit, but it can solve related memory errors that sometimes happen during large uploads. If other methods don’t work, increasing the PHP memory limit is a good next step.

You will need to edit your wp-config.php file. You can access it using an FTP client or the File Manager app in your hosting control panel (cPanel).

For detailed instructions, check our guide on how to find and edit the wp-config.php file.

Once you have the file open, add the following line of code just before the line that says, /* That's all, stop editing! Happy publishing. */.

define( 'WP_MEMORY_LIMIT', '256M' );

This code increases the memory available to WordPress to 256MB. After saving the file, try your upload again to see if the error is resolved.

Method 7: Contact Your Hosting Provider

If you’ve tried all of the methods above and the error still won’t go away, it might be time to contact your WordPress hosting provider. The problem could be on their end, and their support team can look into it for you.

When you reach out, be sure to clearly explain the error and the steps you’ve already taken to fix it. If you’re not sure how to ask for help, our guide on how to properly ask for WordPress support has some great tips.

Frequently Asked Questions (FAQ)

Why does WordPress say ‘The link you followed has expired’?

This error almost always means the theme or plugin file you’re trying to upload is larger than the maximum upload size allowed by your server’s settings. It’s a security and performance measure set by your web host.

What is the recommended file upload size for WordPress?

There’s no single recommended size, but 64MB or 128MB is usually enough for most themes and plugins. You can check your current limit under Media » Add New and increase it if needed.

Is it safe to edit wp-config.php or .htaccess files?

Editing these files can be risky for beginners. A small mistake can take your site offline. That’s why we recommend using a plugin like WPCode (Method 1) or making a complete backup of your site before attempting to edit these files directly.

What if increasing limits doesn’t fix the error?

If increasing the limits doesn’t work, try checking for a plugin conflict or updating your PHP version. If the problem persists, it’s best to contact your hosting provider for help.

How can I check my current PHP limits?

The easiest way is to go to Tools » Site Health in your WordPress dashboard, click on the ‘Info’ tab, and open the ‘Server’ dropdown. This will show you key limits like upload_max_filesize, post_max_size, and memory_limit.

We hope this article helped you easily fix ‘The link you followed has expired’ in WordPress. You may also want to bookmark our ultimate guide on how to fix the most common WordPress errors and check out our list of solutions for common block editor problems.

If you liked this article, then please subscribe to our YouTube Channel for WordPress video tutorials. You can also find us on Twitter and Facebook.

Disclosure: Our content is reader-supported. This means if you click on some of our links, then we may earn a commission. See how WPBeginner is funded, why it matters, and how you can support us. Here's our editorial process.

The Ultimate WordPress Toolkit

Get FREE access to our toolkit - a collection of WordPress related products and resources that every professional should have!

Reader Interactions

66 CommentsLeave a Reply

    • If none of the methods from our guide were able to assist then we would recommend reaching out to your hosting provider to ensure they don’t have a setting on their end that is overriding your attempts.

      Admin

  1. What worked for me was to create a .user.ini file in the public_html folder and put the code mentioned above for php.ini

    • It would depend on how your server is set up as not all servers allow user.ini but that is good to know for servers that do :)

      Admin

  2. Editing limits using the .user.ini file also works on Linux. The directives are very similar. Some providers also prefer the user.ini file to the .htacess file. Thanks for the great video. In the end, it helped me to raise the limits only through the mentioned .user.ini.

  3. Doesn’t work. I’ve run into this before and got it to work but it was awhile back. searched Google and found these instructions but they don’t work for my site.

    • If none of the methods in our guide were able to help you, please reach out to your hosting provider and they should be able to assist.

      Admin

  4. I am running Wordpress on my iMac at localhost:8888 but changing the sizes in wpcode made no difference. After editing the htaccess file, I was able to upload the theme, so cheers

  5. I followed every single step as mentioned to work around the problem of uploading a theme to wordpress when upload limit was too low. Used the WP Code Snippet to increase the limits and still the same message: “link expired”

    • If our recommendations do not work for you, please reach out to your hosting provider and they should be able to assist with this issue.

      Admin

  6. I am using GCP.
    It works only after modifying php.ini under fpm, and restart php-fpm
    Modifying .htaccess would lead to internal server error.

  7. I tried 3 methods all. But the limit value was not changed.
    On the ‘Add New’ page from ‘Media’, the Maximum upload file size is still 2MB.
    Do I need to restart service or something?
    Please help me.

    • Your hosting provider may be overriding the max file size, if you check with your host they should be able to assist!

      Admin

    • Everyone can make a typo like that but we’re glad you were able to find and solve the issue for you :)

      Admin

  8. I’m having an issue: I’ve added the htaccess text at the end and it did not work. I removed any formating on the text and it still did not work. I need help.

  9. I tried all the steps but I still have the issue. I have the issue every time I click on save/submit. For example, update WordPress version. Enable debug mode in Elementor. Disable all plugins.
    Please help to let me know how can I fix it, please.

  10. In my dashboard Maximum upload file size is 512 MB. but still, I’m facing this issue but I’m facing this issue while deactivating the plugin… can you help me…

    • You would want to check with your hosting provider to ensure they are not overriding any of your changes.

      Admin

  11. This guide helped me a lot. I had this problem with local WordPress. I couldn’t upload my customize theme to test it.

    Thank you so much.

  12. Thanks very much Method 3 worked.

    But, Server error when I edit the .htaccess file and Adding to functions.php doesnt work.

    • Glad our guide was helpful, if any of the methods don’t work then we would recommend checking with your host as those are settings that may be getting ignored due to server settings.

      Admin

  13. I get a 500 Internal Server error when I edit the .htaccess file. How do I add the code without getting this error. Adding to functions.php doesnt work for me

  14. Many thanks, your method 2 worked for me on 04-JULY-2020. I have added following code before the tag:

    php_value upload_max_filesize 128M
    php_value post_max_size 128M
    php_value max_execution_time 300
    php_value max_input_time 300

  15. Thank you so much. This really worked!

    I followed the second method and now I have the theme installed.

    Keep doing what you do.

    • You may want to reach out to your hosting provider to ensure they’re not overriding the changed you’re making and that they don’t see any errors from their end.

      Admin

    • Apologies if our explanation was not clear, the php.ini should be in your site’s root folder.

      Admin

  16. I have a client having this issue but only on the woocommerce login form. If you click link to try again it works. Any ideas?

    • If the methods in this article and resaving your permalinks does not fix the issue, you would want to reach out to WooCommerce for assistance.

      Admin

Leave A Reply

Thanks for choosing to leave a comment. Please keep in mind that all comments are moderated according to our comment policy, and your email address will NOT be published. Please Do NOT use keywords in the name field. Let's have a personal and meaningful conversation.