Home WordPress

How To Increase WordPress Memory Limit (5 Proven Methods)

Written by: Muninder

Updated: March 31, 2026

If you’ve ever seen the dreaded “Allowed memory size of X bytes exhausted” error in WordPress, you’re not alone. This happens when WordPress runs out of memory while executing a task—usually when installing plugins, uploading large images, or running memory-intensive operations.

The default WordPress memory limit is typically 32MB to 64MB, which isn’t enough for many modern sites. Here’s how to increase it.

What is the WordPress Memory Limit?

WordPress memory limit is the maximum amount of server memory (RAM) that PHP can use to run your WordPress site. When your site tries to use more memory than allowed, you’ll see errors like:

  • Fatal error: Allowed memory size of 67108864 bytes exhausted
  • White screen of death (WSOD)
  • Plugin/theme installation failures
  • Image upload errors

How to Check Your Current Memory Limit

Before increasing the limit, check what it’s currently set to. Add this to any PHP file or use a plugin:

<?php echo 'Memory Limit: ' . ini_get('memory_limit'); ?>

Or check via Tools → Site Health → Info → Server in your WordPress dashboard.

This is the most reliable method and works on most hosting providers.

  1. Connect to your site via FTP or File Manager
  2. Open wp-config.php in your WordPress root directory
  3. Add this line before the line that says /* That's all, stop editing! */:
define('WP_MEMORY_LIMIT', '256M');

For admin tasks that need more memory:

define('WP_MAX_MEMORY_LIMIT', '512M');
  1. Save the file and refresh your site

What these values mean:

  • WP_MEMORY_LIMIT - Memory for front-end operations
  • WP_MAX_MEMORY_LIMIT - Memory for admin/backend operations

Method 2: Edit .htaccess File

If your server runs Apache, you can modify the .htaccess file:

  1. Open .htaccess in your WordPress root directory
  2. Add this line at the top:
php_value memory_limit 256M
  1. Save and test your site

Note: This only works on Apache servers. If you’re on Nginx, skip to the php.ini method.

Method 3: Edit php.ini

If you have access to your server’s PHP configuration:

  1. Locate or create a php.ini file in your WordPress root
  2. Add or modify this line:
memory_limit = 256M
  1. Restart your web server

Some hosts don’t allow custom php.ini files. Contact your hosting provider if this doesn’t work.

Method 4: Contact Your Hosting Provider

If none of the above methods work, your hosting provider may have restrictions in place. Shared hosting often caps memory limits.

What to ask:

  • “Can you increase my PHP memory limit to 256M?”
  • “What’s the maximum memory limit allowed on my plan?”

Most quality hosts will do this for free. If they refuse or charge extra, it might be time to consider upgrading your hosting plan.

Method 5: Use a Plugin (Quick Fix)

If you’re not comfortable editing files, plugins like WP Memory Usage or Health Check & Troubleshooting can help identify memory issues. However, they can’t actually increase limits—that requires server-level changes.

How Much Memory Do You Need?

Here’s a general guide:

Site TypeRecommended Memory
Simple blog128M
Standard WordPress site256M
WooCommerce store256M - 512M
Large site with many plugins512M+

Warning: Don’t set the limit higher than your server actually has. If your hosting plan includes 512MB RAM, setting the limit to 1GB won’t help—and could cause issues.

Still Getting Memory Errors?

If increasing the limit doesn’t help, the problem might be elsewhere:

  1. Poorly coded plugins - Disable plugins one by one to find the culprit
  2. Theme issues - Switch to a default theme temporarily
  3. Too many plugins - Each plugin uses memory; remove unused ones
  4. Large images - Optimize images before uploading
  5. Outdated PHP - Upgrade to PHP 8.0+ for better memory management

Quick Troubleshooting

Memory limit shows correct value but still getting errors?

  • Your host may be overriding settings
  • Try a different method (wp-config vs .htaccess)
  • Contact hosting support

Changes not taking effect?

  • Clear any caching plugins
  • Clear your browser cache
  • Wait a few minutes for server changes to propagate

Conclusion

Increasing your WordPress memory limit is usually straightforward:

  1. First try: Add define('WP_MEMORY_LIMIT', '256M'); to wp-config.php
  2. If that fails: Try .htaccess or php.ini
  3. Last resort: Contact your hosting provider

Most sites run fine with 256MB. If you consistently need more, consider optimizing your site or upgrading to better hosting.

Got questions? Drop a comment below and I’ll help you troubleshoot.

by Muninder