# Changing the WordPress memory limit

> Raise the WordPress memory limit in wp-config.php to fix 'Allowed memory size exhausted' errors from heavy plugins.

Source: https://helpcenter.ruachost.com/wordpress/guides/changing-the-wordpress-memory-limit/

Some WordPress plugins and themes require more memory than the default allocation. By default, WordPress sets the PHP memory limit to **40MB**, which may not be sufficient for complex sites. On **ruachost.com**, you can increase the memory limit by editing the `wp-config.php` file.

## Why Increase the Memory Limit?

- Prevents “Allowed memory size exhausted” errors.
- Ensures heavy plugins (e.g., WooCommerce, page builders) run smoothly.
- Improves site stability and performance.

## Steps to Change the WordPress Memory Limit

1. **Log in to your hosting account** (via cPanel or File Manager).
2. Navigate to your WordPress installation directory.
3. Locate and open the **wp-config.php** file.
4. Search for the following line (if it exists):

   ```
   define( 'WP_MEMORY_LIMIT', '40M' );
   ```
5. Change the value to a higher limit, such as **64MB** or **128MB**:

   ```
   define( 'WP_MEMORY_LIMIT', '128M' );
   ```
6. If the line does not exist, add the following code just above the line:

   ```
   /* That's all, stop editing! Happy publishing. */
   ```

   Insert:

   ```
   define( 'WP_MEMORY_LIMIT', '128M' );
   define( 'WP_MAX_MEMORY_LIMIT', '256M' );
   ```
7. Save the file.
8. Log in to WordPress → Go to **Tools → Site Health → Info → WordPress Constants** to confirm the new memory limit.

## Important Notes

- Always back up your site before editing configuration files.
- Use a **child theme** if editing theme‑related settings.
- Increasing memory beyond what your server can handle may cause performance issues.
