To increase the memory_limit for a WordPress site, you can modify the wp-config.php file to allocate more memory. Here’s how to do it:
Steps to Change memory_limit in wp-config.php:
Access Your WordPress Site's Files
You can access the files via an FTP client (e.g., FileZilla), through your hosting provider's file manager, or directly on your local machine if you're running WordPress locally.
Open wp-config.php
The wp-config.php file is located in the root directory of your WordPress installation (the same directory as wp-content, wp-admin, and wp-includes).
Edit the File
Add the following line to the wp-config.php file, ideally above the line that says /* That's all, stop editing! Happy publishing. */:
define( 'WP_MEMORY_LIMIT', '256M' );
This example sets the memory limit to 256MB, but you can increase or decrease this value based on your needs (e.g., 128M, 512M).
Save the Changes
After making the changes, save the wp-config.php file and upload it back to the server (if applicable).
Notes:
WP_MEMORY_LIMIT: This sets the maximum memory limit that WordPress can use. If your server configuration allows it, WordPress will use this memory limit.
If you're running a multisite installation, you may also want to set the memory limit specifically for the admin dashboard:
define( 'WP_MAX_MEMORY_LIMIT', '512M' );
Additional Considerations:
Server Configurations: Even though you set the memory limit in wp-config.php, your hosting provider might have server-level restrictions (e.g., php.ini or .htaccess files). If the above change doesn’t work, you may need to contact your hosting provider to increase the PHP memory limit or edit the php.ini file directly if you have access.
php.ini Settings: You can also try modifying the memory limit by editing the php.ini file (if accessible):
ini file
memory_limit = 256M
Once the wp-config.php is updated, your WordPress site should have more memory available for handling processes like plugins, themes, and content management.