Increase WordPress Memory Limit

What does this error mean?

The error Fatal error: Allowed memory size of X bytes exhausted means that WordPress tried to use more RAM than allowed. It frequently occurs on sites with many plugins, WooCommerce with many products, or when importing content.

Method 1 — wp-config.php (recommended)

Open wp-config.php in public_html and add before the line /* That's all, stop editing! */:

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

Method 2 — .htaccess

Add to your .htaccess in public_html:

php_value memory_limit 256M

Method 3 — PHP Selector in cPanel

  1. Go to cPanel → Select PHP Version
  2. Navigate to the PHP Options tab
  3. Change memory_limit to 256M or 512M
  4. Save
Recommended values according to site type:
  • Blog or simple site: 128M
  • WordPress with plugins: 256M
  • WooCommerce: 512M
  • WooCommerce with many products: 1G
✅ Verify the change: Install the Query Monitor plugin to see real-time memory usage in the WordPress admin bar.