{"id":31227,"date":"2025-04-27T16:57:23","date_gmt":"2025-04-27T10:57:23","guid":{"rendered":"https:\/\/codexpert.io\/?p=31227"},"modified":"2025-05-20T09:32:07","modified_gmt":"2025-05-20T03:32:07","slug":"how-to-increase-wordpress-memory-limit","status":"publish","type":"post","link":"https:\/\/codexpert.io\/blog\/how-to-increase-wordpress-memory-limit\/","title":{"rendered":"How to Increase WordPress Memory Limit: 5 Easy Methods"},"content":{"rendered":"<div class='cx-content-before'><\/div>\n<p class=\"has-black-color has-text-color has-link-color wp-elements-1 wp-block-paragraph\">Ever tried installing a plugin or them in your WordPress, only to be met with a frustrating <strong>&#8216;Allowed memory size exhausted&#8217; <\/strong>error?&nbsp;Yeah, it\u2019s one of those annoying roadblocks that hits you out of nowhere, especially when you&#8217;re in the middle of something important.<\/p>\n\n\n\n<p class=\"has-black-color has-text-color has-link-color wp-elements-2 wp-block-paragraph\">This issue usually means your WordPress site doesn\u2019t have enough memory to handle the upload you want to make happen. It can slow things down, break pages, or crash your site completely.&nbsp;<\/p>\n\n\n\n<p class=\"has-black-color has-text-color has-link-color wp-elements-3 wp-block-paragraph\">The good news is, you don\u2019t need to be a developer to fix it. In this post, we will guide you through five easy methods to increase WordPress memory limit, Let\u2019s get your site running smoothly again!<\/p>\n\n\n\n<h2 class=\"wp-block-heading has-black-color has-text-color has-link-color wp-elements-4\" style=\"font-size:28px\" id=\"cx-heading-1\">Definition of WordPress Memory Limit<\/h2>\n\n\n\n<p class=\"has-black-color has-text-color has-link-color wp-elements-5 wp-block-paragraph\">The WordPress Memory Limit refers to the maximum amount of PHP memory the server allocates. These settings define how much memory a WordPress site can use to execute scripts and processes. Such as loading plugins, processing large database queries, rendering themes, or running background tasks like cron jobs.<\/p>\n\n\n\n<p class=\"has-black-color has-text-color has-link-color wp-elements-6 wp-block-paragraph\">Many hosting providers set this limit relatively low (often 32MB or 64MB) by default, which can lead to &#8216;<strong>Allowed memory size exhausted<\/strong>&#8216; errors when resource-intensive operations exceed the cap.<\/p>\n\n\n\n<p class=\"has-black-color has-text-color has-link-color wp-elements-7 wp-block-paragraph\">Increasing the WordPress memory limit typically via <strong>wp-config.php<\/strong>, <strong>php.ini<\/strong>, or <strong>.htaccess<\/strong> ensures better performance and stability, specifically on dynamic or plugin-heavy sites.<\/p>\n\n\n\n<p class=\"has-black-color has-text-color has-link-color wp-elements-8 wp-block-paragraph\">However, aligning this value with your hosting provider\u2019s constraints is essential to avoid conflicts or server resource overuse.<\/p>\n\n\n\n<h2 class=\"wp-block-heading has-black-color has-text-color has-link-color wp-elements-9\" style=\"font-size:28px\" id=\"cx-heading-2\">How Much Memory Does WordPress Need?<\/h2>\n\n\n\n<p class=\"has-black-color has-text-color has-link-color wp-elements-10 wp-block-paragraph\">The amount of memory WordPress needs depends on your site\u2019s size, complexity, and the number of plugins or themes in use.<\/p>\n\n\n\n<ul style=\"font-size:17px\" class=\"wp-block-list has-ast-global-color-8-color has-text-color has-link-color wp-elements-11\">\n<li><strong>Minimum Requirement:<\/strong> WordPress itself can run on as little as <strong>32MB of PHP memory<\/strong>, which is often the default on shared hosting.<\/li>\n<\/ul>\n\n\n\n<ul style=\"font-size:17px\" class=\"wp-block-list has-ast-global-color-8-color has-text-color has-link-color wp-elements-12\">\n<li><strong>Recommended for Most Sites:<\/strong> For standard websites with a few plugins and a modern theme, <strong>128MB<\/strong> is sufficient.<\/li>\n<\/ul>\n\n\n\n<ul style=\"font-size:17px\" class=\"wp-block-list has-ast-global-color-8-color has-text-color has-link-color wp-elements-13\">\n<li><strong>For Ecommerce Sites:<\/strong> If you are running an <strong><a href=\"https:\/\/wordpress.org\/plugins\/easycommerce\" target=\"_blank\" rel=\"noreferrer noopener\">ecommerce plugin<\/a> <\/strong>with membership systems, multilingual plugins, or large media libraries in your site, you will likely <strong>need 256MB<\/strong> or more to ensure smooth performance.<\/li>\n<\/ul>\n\n\n\n<ul style=\"font-size:17px\" class=\"wp-block-list has-ast-global-color-8-color has-text-color has-link-color wp-elements-14\">\n<li><strong>For Complex Sites:<\/strong> Advanced setups with page builders, staging environments, or custom post types sites <strong>require 512MB<\/strong> or higher, especially during imports, backups, or cron jobs.<\/li>\n<\/ul>\n\n\n\n<div style=\"height:15px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n\n\n<p class=\"has-black-color has-text-color has-link-color wp-elements-15 wp-block-paragraph\"><strong>Note:<\/strong> It\u2019s always best to allocate only what you need and <strong>increase WordPress&#8217; memory limit<\/strong> periodically to avoid unnecessary loads.<\/p>\n\n\n\n<h2 class=\"wp-block-heading has-black-color has-text-color has-link-color wp-elements-16\" style=\"font-size:28px\" id=\"cx-heading-3\">How to Check the WordPress Memory Limit?<\/h2>\n\n\n\n<p class=\"has-black-color has-text-color has-link-color wp-elements-17 wp-block-paragraph\">There are multiple ways you can check your WordPress site&#8217;s PHP Memory Limit. Here are a couple of easy ways to check it:<\/p>\n\n\n\n<h3 class=\"wp-block-heading has-black-color has-text-color has-link-color wp-elements-18\" style=\"font-size:26px\" id=\"cx-heading-4\">Step 1: Use a Plugin (Easy for Beginners)<\/h3>\n\n\n\n<ul style=\"font-size:17px\" class=\"wp-block-list has-ast-global-color-8-color has-text-color has-link-color wp-elements-19\">\n<li>Install a plugin like <strong><a href=\"https:\/\/wordpress.org\/plugins\/health-check\" target=\"_blank\" rel=\"noreferrer noopener\">Health Check &amp; Troubleshooting<\/a> <\/strong>or <strong>WP Site Health<\/strong>.<\/li>\n<\/ul>\n\n\n\n<ul style=\"font-size:17px\" class=\"wp-block-list has-ast-global-color-8-color has-text-color has-link-color wp-elements-20\">\n<li>Go to your <strong>WordPress Dashboard &gt; Tools &gt; Site Health<\/strong>. Click the <strong>Info<\/strong> tab and look under <strong>Server or PHP<\/strong>. You\u2019ll see the current memory limit <strong>(e.g., WP Memory Limit: 128M)<\/strong>.<\/li>\n<\/ul>\n\n\n\n<div style=\"height:15px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n\n\n<figure class=\"wp-block-image aligncenter size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"918\" height=\"862\" src=\"https:\/\/codexpert.io\/wp-content\/uploads\/2025\/04\/server_wordpress_info.png\" alt=\"\" class=\"wp-image-31237\" srcset=\"https:\/\/codexpert.io\/blog\/wp-content\/uploads\/2025\/04\/server_wordpress_info.png 918w, https:\/\/codexpert.io\/blog\/wp-content\/uploads\/2025\/04\/server_wordpress_info-300x282.png 300w, https:\/\/codexpert.io\/blog\/wp-content\/uploads\/2025\/04\/server_wordpress_info-768x721.png 768w\" sizes=\"auto, (max-width: 918px) 100vw, 918px\" \/><\/figure>\n\n\n\n<ul class=\"wp-block-list\">\n<li class=\"has-ast-global-color-8-color has-text-color has-link-color wp-elements-21\" style=\"font-size:17px\">Keep scrolling through the server settings until you see the PHP memory limit.<\/li>\n<\/ul>\n\n\n\n<div style=\"height:15px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n\n\n<figure class=\"wp-block-image aligncenter size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"589\" src=\"https:\/\/codexpert.io\/wp-content\/uploads\/2025\/04\/php_memory-limit-1024x589.png\" alt=\"server info for WordPress memory limit\" class=\"wp-image-31260\" srcset=\"https:\/\/codexpert.io\/blog\/wp-content\/uploads\/2025\/04\/php_memory-limit-1024x589.png 1024w, https:\/\/codexpert.io\/blog\/wp-content\/uploads\/2025\/04\/php_memory-limit-300x173.png 300w, https:\/\/codexpert.io\/blog\/wp-content\/uploads\/2025\/04\/php_memory-limit-768x442.png 768w, https:\/\/codexpert.io\/blog\/wp-content\/uploads\/2025\/04\/php_memory-limit.png 1034w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<h3 class=\"wp-block-heading has-black-color has-text-color has-link-color wp-elements-22\" style=\"font-size:26px\" id=\"cx-heading-5\">Step 2: Check wp-config.php (For Intermediate Users)<\/h3>\n\n\n\n<ul style=\"font-size:17px\" class=\"wp-block-list has-ast-global-color-8-color has-text-color has-link-color wp-elements-23\">\n<li>Access your site files via <strong>FTP or File Manager<\/strong> in your hosting dashboard.<\/li>\n\n\n\n<li>Open the <strong>wp-config.php<\/strong> file (in your root WordPress folder).<\/li>\n\n\n\n<li>Look for this line <strong>define(&#8216;WP_MEMORY_LIMIT&#8217;, &#8216;128M&#8217;)<\/strong>. That\u2019s your memory limit. If it\u2019s not there, WordPress is using the default set by your server. <\/li>\n<\/ul>\n\n\n\n<div style=\"height:15px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n\n\n<p class=\"has-black-color has-text-color has-link-color wp-elements-24 wp-block-paragraph\">Next, we will explore the detail overview on how to increase WordPress PHP memory limit.<\/p>\n\n\n\n<h2 class=\"wp-block-heading has-black-color has-text-color has-link-color wp-elements-25\" style=\"font-size:28px\" id=\"cx-heading-6\">How to Increase PHP Memory Limit in WordPress: Methods and Steps<\/h2>\n\n\n\n<p class=\"has-black-color has-text-color has-link-color wp-elements-26 wp-block-paragraph\">In this section, we will show you how you can increase WordPress Memory Limit using five simple and easy methods.<\/p>\n\n\n\n<div class=\"wp-block-group has-black-color has-pale-cyan-blue-background-color has-text-color has-background has-link-color has-medium-font-size wp-elements-27 is-layout-constrained wp-container-core-group-is-layout-e3964afe wp-block-group-is-layout-constrained\" style=\"padding-top:var(--wp--preset--spacing--60);padding-right:var(--wp--preset--spacing--60);padding-bottom:var(--wp--preset--spacing--60);padding-left:var(--wp--preset--spacing--60)\">\n<p class=\"has-black-color has-text-color has-link-color wp-elements-28 wp-block-paragraph\"><strong>1. Edit your wp-config.php<\/strong><\/p>\n\n\n\n<p class=\"has-black-color has-text-color has-link-color wp-elements-29 wp-block-paragraph\"><strong>2. Edit your PHP.ini file<\/strong><\/p>\n\n\n\n<p class=\"has-black-color has-text-color has-link-color wp-elements-30 wp-block-paragraph\"><strong>3. Edit your .htaccess file<\/strong><\/p>\n\n\n\n<p class=\"has-black-color has-text-color has-link-color wp-elements-31 wp-block-paragraph\"><strong>4. Using an FTP\/SFTP<\/strong><\/p>\n\n\n\n<p class=\"has-black-color has-text-color has-link-color wp-elements-32 wp-block-paragraph\"><strong>5. Using File Manager<\/strong><\/p>\n<\/div>\n\n\n\n<p class=\"has-black-color has-text-color has-link-color wp-elements-33 wp-block-paragraph\">Below we will explore each method in a step-by-step format. Let&#8217;s get into it!  <\/p>\n\n\n\n<h3 class=\"wp-block-heading has-black-color has-text-color has-link-color wp-elements-34\" style=\"font-size:26px\" id=\"cx-heading-7\">Method 1: Edit your wp-config.php WordPress Memory Limit File<\/h3>\n\n\n\n<p class=\"has-black-color has-text-color has-link-color wp-elements-35 wp-block-paragraph\">The wp-config.php file is one of the most important files in your WordPress site. It holds your site\u2019s basic settings, including how much memory WordPress can use.<\/p>\n\n\n\n<p class=\"has-black-color has-text-color has-link-color wp-elements-36 wp-block-paragraph\" style=\"font-size:22px\"><strong>To increase WordPress memory limit:<\/strong><\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li class=\"has-ast-global-color-8-color has-text-color has-link-color wp-elements-37\" style=\"font-size:17px\"><strong>Find the wp-config.php file<\/strong> \u2013 it\u2019s located in the main (root) folder of your WordPress installation.<\/li>\n<\/ul>\n\n\n\n<div style=\"height:15px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n\n\n<figure class=\"wp-block-image aligncenter size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"984\" height=\"516\" src=\"https:\/\/codexpert.io\/wp-content\/uploads\/2025\/04\/wp_config_edit.png\" alt=\"\" class=\"wp-image-31245\" srcset=\"https:\/\/codexpert.io\/blog\/wp-content\/uploads\/2025\/04\/wp_config_edit.png 984w, https:\/\/codexpert.io\/blog\/wp-content\/uploads\/2025\/04\/wp_config_edit-300x157.png 300w, https:\/\/codexpert.io\/blog\/wp-content\/uploads\/2025\/04\/wp_config_edit-768x403.png 768w\" sizes=\"auto, (max-width: 984px) 100vw, 984px\" \/><\/figure>\n\n\n\n<ul class=\"wp-block-list\">\n<li class=\"has-ast-global-color-8-color has-text-color has-link-color wp-elements-38\" style=\"font-size:17px\">Open the file using a code editor or through your hosting file manager. Look for the line below (or add it if it\u2019s not there):<\/li>\n<\/ul>\n\n\n\n<div style=\"height:15px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n\n\n<pre class=\"wp-block-code has-black-color has-text-color has-link-color wp-elements-39\" style=\"font-size:17px\"><code>define('WP_MEMORY_LIMIT', '64M');<\/code><\/pre>\n\n\n\n<ul class=\"wp-block-list\">\n<li class=\"has-ast-global-color-8-color has-text-color has-link-color wp-elements-40\" style=\"font-size:17px\">Change the number to a higher value, like:<\/li>\n<\/ul>\n\n\n\n<div style=\"height:15px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n\n\n<pre class=\"wp-block-code has-black-color has-text-color has-link-color wp-elements-41\" style=\"font-size:17px\"><code>define('WP_MEMORY_LIMIT', '128M');<\/code><\/pre>\n\n\n\n<p class=\"has-black-color has-text-color has-link-color wp-elements-42 wp-block-paragraph\">Or even:<\/p>\n\n\n\n<pre class=\"wp-block-code has-black-color has-text-color has-link-color wp-elements-43\" style=\"font-size:17px\"><code>define('WP_MEMORY_LIMIT', '256M');<\/code><\/pre>\n\n\n\n<figure class=\"wp-block-image aligncenter size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"932\" height=\"728\" src=\"https:\/\/codexpert.io\/wp-content\/uploads\/2025\/04\/place-wp-config-code.png\" alt=\"add the code to increase memory limit in WordPress.\" class=\"wp-image-31252\" srcset=\"https:\/\/codexpert.io\/blog\/wp-content\/uploads\/2025\/04\/place-wp-config-code.png 932w, https:\/\/codexpert.io\/blog\/wp-content\/uploads\/2025\/04\/place-wp-config-code-300x234.png 300w, https:\/\/codexpert.io\/blog\/wp-content\/uploads\/2025\/04\/place-wp-config-code-768x600.png 768w\" sizes=\"auto, (max-width: 932px) 100vw, 932px\" \/><\/figure>\n\n\n\n<ul style=\"font-size:17px\" class=\"wp-block-list has-ast-global-color-8-color has-text-color has-link-color wp-elements-44\">\n<li>Save the file and reload your website to see if the error is fixed.<\/li>\n<\/ul>\n\n\n\n<div style=\"height:15px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n\n\n<p class=\"has-black-color has-text-color has-link-color wp-elements-45 wp-block-paragraph\"><strong>Note:<\/strong> Some hosting providers limit how much memory you can use. If your changes don\u2019t work, you may need to contact your hosting support for help.<\/p>\n\n\n\n<p class=\"has-black-color has-text-color has-link-color wp-elements-46 wp-block-paragraph\">Start with <strong>128M<\/strong>, and increase if needed, but don\u2019t go too high, as it could cause server issues. If you&#8217;re still getting a memory error, your host should be able to assist further.<\/p>\n\n\n\n<h3 class=\"wp-block-heading has-black-color has-text-color has-link-color wp-elements-47\" style=\"font-size:26px\" id=\"cx-heading-8\">Method 2: Edit your PHP.ini file to increase the WP memory limit<\/h3>\n\n\n\n<p class=\"has-black-color has-text-color has-link-color wp-elements-48 wp-block-paragraph\">If editing the wp-config.php file didn\u2019t fix the memory issue, the problem might be with your server\u2019s PHP settings. This means you\u2019ll need to adjust the memory limit from the php.ini file, which controls how much memory PHP (the language WordPress is built on) can use.<\/p>\n\n\n\n<p class=\"has-black-color has-text-color has-link-color wp-elements-49 wp-block-paragraph\">Remember, if you&#8217;re on shared hosting, you probably won&#8217;t have access to the php.ini file. But if you do have access, here&#8217;s what to do:<\/p>\n\n\n\n<ul style=\"font-size:17px\" class=\"wp-block-list has-ast-global-color-8-color has-text-color has-link-color wp-elements-50\">\n<li>Find your php.ini file. It\u2019s usually located in the root folder of your WordPress installation.<\/li>\n\n\n\n<li>If you can\u2019t find it, no worries,&nbsp; just create a new file named php.ini and place it in your WordPress root directory.<\/li>\n\n\n\n<li>Open the file using a text editor. Look for this line (or add it if it doesn\u2019t exist): <strong>memory_limit = 32M. Change it to a higher value, like: memory_limit = 256M or memory_limit = 512M<\/strong><\/li>\n\n\n\n<li>Save the file, and restart your server or localhost if needed.<\/li>\n<\/ul>\n\n\n\n<div style=\"height:15px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n\n\n<p class=\"has-black-color has-text-color has-link-color wp-elements-51 wp-block-paragraph\">In some cases, when you&#8217;re adjusting PHP settings, the values should follow a logical order. <strong>upload_max_filesize<\/strong> should be the smallest, <strong>post_max_size<\/strong> a bit higher, and <strong>memory_limit <\/strong>should be the largest. This helps avoid conflicts and ensures everything runs smoothly.<\/p>\n\n\n\n<p class=\"has-black-color has-text-color has-link-color wp-elements-52 wp-block-paragraph\">After making your changes, clear your browser\u2019s cookies and cache, then refresh your site to see if the memory limit error is resolved.<\/p>\n\n\n\n<h3 class=\"wp-block-heading has-black-color has-text-color has-link-color wp-elements-53\" style=\"font-size:26px\" id=\"cx-heading-9\">Method 3:&nbsp;Edit your .htaccess file<\/h3>\n\n\n\n<p class=\"has-black-color has-text-color has-link-color wp-elements-54 wp-block-paragraph\">If you don\u2019t have access to the php.ini file, you can try increasing WordPress memory limit using the .htaccess file. This is usually a last resort, but it can work.<\/p>\n\n\n\n<p class=\"has-black-color has-text-color has-link-color wp-elements-55 wp-block-paragraph\">The .htaccess file is a hidden system file located in the root directory of your WordPress site. If you don\u2019t see it, your file manager (or SFTP client) might be hiding hidden files. Make sure you enable the option to view hidden files so you can access it.<\/p>\n\n\n\n<figure class=\"wp-block-image aligncenter size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"964\" height=\"493\" src=\"https:\/\/codexpert.io\/wp-content\/uploads\/2025\/04\/edit_htaccess.png\" alt=\"edit .htaccess file.\" class=\"wp-image-31243\" srcset=\"https:\/\/codexpert.io\/blog\/wp-content\/uploads\/2025\/04\/edit_htaccess.png 964w, https:\/\/codexpert.io\/blog\/wp-content\/uploads\/2025\/04\/edit_htaccess-300x153.png 300w, https:\/\/codexpert.io\/blog\/wp-content\/uploads\/2025\/04\/edit_htaccess-768x393.png 768w\" sizes=\"auto, (max-width: 964px) 100vw, 964px\" \/><\/figure>\n\n\n\n<p class=\"has-black-color has-text-color has-link-color wp-elements-56 wp-block-paragraph\">Add these lines to your .htaccess File:<\/p>\n\n\n\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\">\n<p class=\"has-black-color has-text-color has-link-color wp-elements-57 wp-block-paragraph\" style=\"font-size:17px\"><strong>php_value memory_limit 256M<\/strong><\/p>\n\n\n\n<p class=\"has-black-color has-text-color has-link-color wp-elements-58 wp-block-paragraph\" style=\"font-size:17px\"><strong>php_value upload_max_filesize 12M<\/strong><\/p>\n\n\n\n<p class=\"has-black-color has-text-color has-link-color wp-elements-59 wp-block-paragraph\" style=\"font-size:17px\"><strong>php_value post_max_size 13M<\/strong><\/p>\n<\/blockquote>\n\n\n\n<p class=\"has-black-color has-text-color has-link-color wp-elements-60 wp-block-paragraph\">This will help you increase your WordPress PHP memory and upload limits for your site.<\/p>\n\n\n\n<figure class=\"wp-block-image aligncenter size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"933\" height=\"728\" src=\"https:\/\/codexpert.io\/wp-content\/uploads\/2025\/04\/htaccess-code-implementation.png\" alt=\".htaccess code implementation to increase WordPress memeory limit\" class=\"wp-image-31254\" srcset=\"https:\/\/codexpert.io\/blog\/wp-content\/uploads\/2025\/04\/htaccess-code-implementation.png 933w, https:\/\/codexpert.io\/blog\/wp-content\/uploads\/2025\/04\/htaccess-code-implementation-300x234.png 300w, https:\/\/codexpert.io\/blog\/wp-content\/uploads\/2025\/04\/htaccess-code-implementation-768x599.png 768w\" sizes=\"auto, (max-width: 933px) 100vw, 933px\" \/><\/figure>\n\n\n\n<p class=\"has-black-color has-text-color has-link-color wp-elements-61 wp-block-paragraph\"><strong>Note:<\/strong> If memory hasn\u2019t been set anywhere else, this can help WordPress use more resources and prevent errors.<\/p>\n\n\n\n<p class=\"has-black-color has-text-color has-link-color wp-elements-62 wp-block-paragraph\"><strong>Optional:<\/strong> Use ini_set() (Limited Use)<\/p>\n\n\n\n<p class=\"has-black-color has-text-color has-link-color wp-elements-63 wp-block-paragraph\">If you&#8217;re editing a specific PHP file and want to increase memory just for that file, you can add this line:<\/p>\n\n\n\n<pre class=\"wp-block-code has-black-color has-text-color has-link-color wp-elements-64\" style=\"font-size:17px\"><code>ini_set('memory_limit', '512M');<\/code><\/pre>\n\n\n\n<p class=\"has-black-color has-text-color has-link-color wp-elements-65 wp-block-paragraph\"><strong>Keep in mind:<\/strong> this only affects the file where you place the code; it won&#8217;t apply site-wide.<\/p>\n\n\n\n<h3 class=\"wp-block-heading has-black-color has-text-color has-link-color wp-elements-66\" style=\"font-size:26px\" id=\"cx-heading-10\">Method 4:&nbsp;Increase the WordPress Memory Limit Using an FTP\/SFTP<\/h3>\n\n\n\n<p class=\"has-black-color has-text-color has-link-color wp-elements-67 wp-block-paragraph\">If you need to increase WordPress memory limit, one way to do that is by editing your site&#8217;s .htaccess or wp-config.php file through an FTP client like FileZilla.<\/p>\n\n\n\n<p class=\"has-black-color has-text-color has-link-color wp-elements-68 wp-block-paragraph\">First, make sure you&#8217;re connected to your website via FTP using your credentials. Once you&#8217;re connected, follow one of the options below depending on which file you want to update.<\/p>\n\n\n\n<h4 class=\"wp-block-heading has-black-color has-text-color has-link-color wp-elements-69\" style=\"font-size:24px\">Option 1: Editing the .htaccess File<\/h4>\n\n\n\n<ul class=\"wp-block-list\">\n<li class=\"has-ast-global-color-8-color has-text-color has-link-color wp-elements-70\" style=\"font-size:17px\">In FileZilla, navigate to your site\u2019s root directory, public_html. Look for a file named .htaccess. If you don\u2019t see it, make sure hidden files are enabled.<\/li>\n\n\n\n<li class=\"has-ast-global-color-8-color has-text-color has-link-color wp-elements-71\" style=\"font-size:17px\">Right-click on .htaccess and choose View\/Edit to open it in your default text editor.<\/li>\n<\/ul>\n\n\n\n<div style=\"height:15px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n\n\n<figure class=\"wp-block-image aligncenter size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"682\" height=\"433\" src=\"https:\/\/codexpert.io\/wp-content\/uploads\/2025\/04\/Edit-root-folder.png\" alt=\"\" class=\"wp-image-31239\" srcset=\"https:\/\/codexpert.io\/blog\/wp-content\/uploads\/2025\/04\/Edit-root-folder.png 682w, https:\/\/codexpert.io\/blog\/wp-content\/uploads\/2025\/04\/Edit-root-folder-300x190.png 300w\" sizes=\"auto, (max-width: 682px) 100vw, 682px\" \/><\/figure>\n\n\n\n<ul class=\"wp-block-list\">\n<li class=\"has-ast-global-color-8-color has-text-color has-link-color wp-elements-72\">In the file, scroll down to find the line that says:<\/li>\n<\/ul>\n\n\n\n<div style=\"height:15px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n\n\n<p class=\"has-black-color has-text-color has-link-color wp-elements-73 wp-block-paragraph\"><strong># END WordPress<\/strong><\/p>\n\n\n\n<p class=\"has-black-color has-text-color has-link-color wp-elements-74 wp-block-paragraph\">Right below that line, add the following:<\/p>\n\n\n\n<pre class=\"wp-block-code has-black-color has-text-color has-link-color wp-elements-75\" style=\"font-size:17px\"><code>php_value memory_limit 256M<\/code><\/pre>\n\n\n\n<ul class=\"wp-block-list\">\n<li class=\"has-ast-global-color-8-color has-text-color has-link-color wp-elements-76\" style=\"font-size:17px\">Save the file and close the editor. FileZilla will prompt you to upload the changes, and click <strong>Yes<\/strong>. Refresh your site to make sure everything works as expected.<\/li>\n<\/ul>\n\n\n\n<div style=\"height:15px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n\n\n<h4 class=\"wp-block-heading has-black-color has-text-color has-link-color wp-elements-77\" style=\"font-size:24px\">Option 2: Editing the wp-config.php File<\/h4>\n\n\n\n<ul style=\"font-size:17px\" class=\"wp-block-list has-ast-global-color-8-color has-text-color has-link-color wp-elements-78\">\n<li>In the same root directory, locate the wp-config.php file. Right-click it and select <strong>View\/Edit<\/strong>.<\/li>\n\n\n\n<li>Look for a line that mentions <strong>WP_MEMORY_LIMIT<\/strong>. If it\u2019s there, change the value to:<\/li>\n<\/ul>\n\n\n\n<div style=\"height:15px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n\n\n<pre class=\"wp-block-code has-black-color has-text-color has-link-color wp-elements-79\" style=\"font-size:17px\"><code>define('WP_MEMORY_LIMIT', '256M');<\/code><\/pre>\n\n\n\n<ul class=\"wp-block-list\">\n<li class=\"has-ast-global-color-8-color has-text-color has-link-color wp-elements-80\" style=\"font-size:17px\">If you don\u2019t see that line, just add it above this line:<\/li>\n<\/ul>\n\n\n\n<div style=\"height:15px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>\/* That&#8217;s all, stop editing! Happy publishing. *\/<\/strong><\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li class=\"has-ast-global-color-8-color has-text-color has-link-color wp-elements-81\" style=\"font-size:17px\">Save the file and close the editor. When FileZilla asks if you want to upload the updated file, click <strong>Yes<\/strong>.<\/li>\n<\/ul>\n\n\n\n<div style=\"height:15px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n\n\n<p class=\"has-black-color has-text-color has-link-color wp-elements-82 wp-block-paragraph\">After making these changes, your site should no longer show the &#8216;<strong>memory limit exhausted<\/strong>&#8216; error.<\/p>\n\n\n\n<h3 class=\"wp-block-heading has-black-color has-text-color has-link-color wp-elements-83\" style=\"font-size:26px\" id=\"cx-heading-11\">Method 5:&nbsp; Use a Free WordPress Memory Using File Manager<\/h3>\n\n\n\n<p class=\"has-black-color has-text-color has-link-color wp-elements-84 wp-block-paragraph\">An easier way to update the <strong>.htaccess file<\/strong> is by using the File Manager in your hosting control panel. In this example, we\u2019ll use <a href=\"https:\/\/hostinger.sjv.io\/aOAnKq\" target=\"_blank\" rel=\"noreferrer noopener\"><strong>Hostinger<\/strong><\/a> <strong>hPanel<\/strong> to complete this process:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li class=\"has-ast-global-color-8-color has-text-color has-link-color wp-elements-85\" style=\"font-size:17px\">Log in to your <strong>hPanel<\/strong>, go to the Files section, and click on <strong>File Manager<\/strong>.<\/li>\n<\/ul>\n\n\n\n<div style=\"height:15px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n\n\n<figure class=\"wp-block-image aligncenter size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"448\" height=\"522\" src=\"https:\/\/codexpert.io\/wp-content\/uploads\/2025\/04\/Hostinger-file-manager.png\" alt=\"click on the file manager plugin.\" class=\"wp-image-31240\" srcset=\"https:\/\/codexpert.io\/blog\/wp-content\/uploads\/2025\/04\/Hostinger-file-manager.png 448w, https:\/\/codexpert.io\/blog\/wp-content\/uploads\/2025\/04\/Hostinger-file-manager-257x300.png 257w\" sizes=\"auto, (max-width: 448px) 100vw, 448px\" \/><\/figure>\n\n\n\n<ul class=\"wp-block-list\">\n<li class=\"has-ast-global-color-8-color has-text-color has-link-color wp-elements-86\" style=\"font-size:17px\">Open the <strong>public_html <\/strong>folder (this is your site\u2019s root directory), then double-click on the <strong>wp-config.php file<\/strong> to edit it.<\/li>\n<\/ul>\n\n\n\n<div style=\"height:15px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n\n\n<figure class=\"wp-block-image aligncenter size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"646\" src=\"https:\/\/codexpert.io\/wp-content\/uploads\/2025\/04\/filemanager-wp-config-file.png\" alt=\"edit the wp-config file.\" class=\"wp-image-31241\" srcset=\"https:\/\/codexpert.io\/blog\/wp-content\/uploads\/2025\/04\/filemanager-wp-config-file.png 1024w, https:\/\/codexpert.io\/blog\/wp-content\/uploads\/2025\/04\/filemanager-wp-config-file-300x189.png 300w, https:\/\/codexpert.io\/blog\/wp-content\/uploads\/2025\/04\/filemanager-wp-config-file-768x485.png 768w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<ul class=\"wp-block-list\">\n<li class=\"has-ast-global-color-8-color has-text-color has-link-color wp-elements-87\" style=\"font-size:17px\">Add the same code mentioned in the FTP method, depending on which file you\u2019re working with. Once done, click <strong>Save &amp; Close<\/strong>.<\/li>\n<\/ul>\n\n\n\n<div style=\"height:15px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n\n\n<p class=\"has-black-color has-text-color has-link-color wp-elements-88 wp-block-paragraph\">Even though this method is pretty simple, it\u2019s always a good idea to back up your site first, just in case something doesn\u2019t go as planned.<\/p>\n\n\n\n<h2 class=\"wp-block-heading has-black-color has-text-color has-link-color wp-elements-89\" style=\"font-size:28px\" id=\"cx-heading-12\">Final Words<\/h2>\n\n\n\n<p class=\"has-black-color has-text-color has-link-color wp-elements-90 wp-block-paragraph\">Running into the \u201cmemory exhausted\u201d error can be annoying, but now you know how to fix it. If you\u2019re editing through FTP, your hosting panel, or directly in WordPress, you\u2019ve got easy ways to increase your memory limit and get things back to normal.<\/p>\n\n\n\n<p class=\"has-black-color has-text-color has-link-color wp-elements-91 wp-block-paragraph\">Just remember to make small changes and back up your site before you start. If you\u2019re still having trouble, don\u2019t hesitate to ask your hosting provider for help. With this issue fixed, you can focus on what matters, like growing your site and others daily activity.<\/p>\n\n\n\n<h2 class=\"wp-block-heading has-black-color has-text-color has-link-color wp-elements-92\" style=\"font-size:28px\" id=\"cx-heading-13\">Frequently Asked Questions (FAQs)<\/h2>\n\n\n\n<h3 class=\"wp-block-heading has-black-color has-text-color has-link-color wp-elements-93\" style=\"font-size:26px\" id=\"cx-heading-14\">Q. How do I increase the memory limit in WordPress?<\/h3>\n\n\n\n<p class=\"has-black-color has-text-color has-link-color wp-elements-94 wp-block-paragraph\">To increase WordPress memory limit, you can manually add the following line to your wp-config.php file, just before the line that says<strong> &#8216;That&#8217;s all, stop editing!<\/strong>&#8216;:<\/p>\n\n\n\n<pre class=\"wp-block-code has-black-color has-text-color has-link-color wp-elements-95\"><code>define('WP_MEMORY_LIMIT', '256M');<\/code><\/pre>\n\n\n\n<p class=\"has-black-color has-text-color has-link-color wp-elements-96 wp-block-paragraph\">If that doesn\u2019t work, you may also need to adjust your php.ini or .htaccess file, depending on your hosting setup. Some hosts allow you to increase memory through their control panel or support team as well.<\/p>\n\n\n\n<h3 class=\"wp-block-heading has-black-color has-text-color has-link-color wp-elements-97\" style=\"font-size:26px\" id=\"cx-heading-15\">Q. What is the highest memory limit for WordPress?<\/h3>\n\n\n\n<p class=\"has-black-color has-text-color has-link-color wp-elements-98 wp-block-paragraph\">Technically, there\u2019s no fixed upper limit set by WordPress itself. The maximum memory limit depends on your server\u2019s PHP configuration and what your hosting provider allows. <\/p>\n\n\n\n<p class=\"has-black-color has-text-color has-link-color wp-elements-99 wp-block-paragraph\">Most shared hosts cap it <strong>between 256MB to 512MB<\/strong>, while VPS or dedicated servers can go higher, even 1GB+ if needed. However, allocating more than necessary isn&#8217;t always better, it should match your site&#8217;s actual resource needs.<\/p>\n\n\n\n<h3 class=\"wp-block-heading has-black-color has-text-color has-link-color wp-elements-100\" style=\"font-size:26px\" id=\"cx-heading-16\">Q. Where can I find my WP memory limit?<\/h3>\n\n\n\n<p class=\"has-black-color has-text-color has-link-color wp-elements-101 wp-block-paragraph\">You can check your current WordPress memory limit in a few easy ways:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li class=\"has-black-color has-text-color has-link-color wp-elements-102\" style=\"font-size:17px\">Use the Site Health tool under <strong>Tools &gt; Site Health &gt; Info &gt; Server<\/strong> in your WordPress dashboard.<\/li>\n\n\n\n<li class=\"has-black-color has-text-color has-link-color wp-elements-103\" style=\"font-size:17px\">Install a plugin like <strong>WP-ServerInfo or Health Check &amp; Troubleshooting<\/strong>.<\/li>\n\n\n\n<li class=\"has-black-color has-text-color has-link-color wp-elements-104\" style=\"font-size:17px\">Look in the <strong>wp-config.php<\/strong> file for a line like:<\/li>\n<\/ul>\n\n\n\n<div style=\"height:15px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n\n\n<pre class=\"wp-block-code has-black-color has-text-color has-link-color wp-elements-105\"><code>define('WP_MEMORY_LIMIT', '128M');<\/code><\/pre>\n\n\n\n<p class=\"has-black-color has-text-color has-link-color wp-elements-106 wp-block-paragraph\">If it\u2019s not defined there, WordPress defaults to what your server allows.<\/p>\n\n\n\n<h3 class=\"wp-block-heading has-black-color has-text-color has-link-color wp-elements-107\" style=\"font-size:26px\" id=\"cx-heading-17\">Q. What is the Maximum Upload Limit in WordPress?<\/h3>\n\n\n\n<p class=\"has-black-color has-text-color has-link-color wp-elements-108 wp-block-paragraph\">The maximum upload limit in WordPress controls the largest file size you can upload through the Media Library. This limit is set by your server configuration, not WordPress itself. Typical values range from 2MB to 256MB.<\/p>\n\n\n\n<p class=\"has-black-color has-text-color has-link-color wp-elements-109 wp-block-paragraph\">To check it:<\/p>\n\n\n\n<ol class=\"wp-block-list\">\n<li class=\"has-black-color has-text-color has-link-color wp-elements-110\" style=\"font-size:17px\">Go to <strong>Media &gt; Add New<\/strong> in your dashboard. You\u2019ll see the limit displayed under the upload box.<\/li>\n\n\n\n<li class=\"has-black-color has-text-color has-link-color wp-elements-111\" style=\"font-size:17px\">To increase it, you need to edit your<strong> php.ini, .htaccess, or contact your hosting provider<\/strong> for help.<\/li>\n<\/ol>\n\n\n\n<div style=\"height:15px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n\n\n<h3 class=\"wp-block-heading has-black-color has-text-color has-link-color wp-elements-112\" style=\"font-size:26px\" id=\"cx-heading-18\">Q. How to fix the WordPress memory exhausted error?<\/h3>\n\n\n\n<p class=\"has-black-color has-text-color has-link-color wp-elements-113 wp-block-paragraph\">The &#8216;<strong>Allowed memory size exhausted<\/strong>&#8216; error means your site ran out of allocated PHP memory. To fix it:<\/p>\n\n\n\n<ol class=\"wp-block-list\">\n<li class=\"has-black-color has-text-color has-link-color wp-elements-114\" style=\"font-size:17px\">Open your <strong>wp-config.php file<\/strong> via FTP or File Manager.<\/li>\n\n\n\n<li class=\"has-black-color has-text-color has-link-color wp-elements-115\" style=\"font-size:17px\">Add or edit this line:<\/li>\n<\/ol>\n\n\n\n<div style=\"height:15px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n\n\n<pre class=\"wp-block-code has-black-color has-text-color has-link-color wp-elements-116\"><code>define('WP_MEMORY_LIMIT', '256M');<\/code><\/pre>\n\n\n\n<p class=\"has-black-color has-text-color has-link-color wp-elements-117 wp-block-paragraph\">Save the file and refresh your site. If the error persists, your server may be capping the memory. You need to contact your hosting support to request an increase. You can also try deactivating heavy plugins or themes that could be consuming too many resources.<\/p>\n<div class='cx-content-after'><\/div>","protected":false},"excerpt":{"rendered":"<p>Ever tried installing a plugin or them in your WordPress, only to be met with a frustrating &#8216;Allowed memory size exhausted&#8217; error?&nbsp;Yeah, it\u2019s one of those annoying roadblocks that hits you out of nowhere, especially when you&#8217;re in the middle of something important. This issue usually means your WordPress site doesn\u2019t have enough memory to [&hellip;]<\/p>\n","protected":false},"author":6,"featured_media":31250,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"site-sidebar-layout":"default","site-content-layout":"","ast-site-content-layout":"default","site-content-style":"default","site-sidebar-style":"default","ast-global-header-display":"","ast-banner-title-visibility":"","ast-main-header-display":"","ast-hfb-above-header-display":"","ast-hfb-below-header-display":"","ast-hfb-mobile-header-display":"","site-post-title":"","ast-breadcrumbs-content":"","ast-featured-img":"","footer-sml-layout":"","theme-transparent-header-meta":"","adv-header-id-meta":"","stick-header-meta":"","header-above-stick-meta":"","header-main-stick-meta":"","header-below-stick-meta":"","astra-migrate-meta-layouts":"set","ast-page-background-enabled":"default","ast-page-background-meta":{"desktop":{"background-color":"var(--ast-global-color-4)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"tablet":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"mobile":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""}},"ast-content-background-meta":{"desktop":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"tablet":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"mobile":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""}},"footnotes":""},"categories":[16],"tags":[352],"class_list":["post-31227","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-wordpress","tag-general"],"_links":{"self":[{"href":"https:\/\/codexpert.io\/blog\/wp-json\/wp\/v2\/posts\/31227","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/codexpert.io\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/codexpert.io\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/codexpert.io\/blog\/wp-json\/wp\/v2\/users\/6"}],"replies":[{"embeddable":true,"href":"https:\/\/codexpert.io\/blog\/wp-json\/wp\/v2\/comments?post=31227"}],"version-history":[{"count":1,"href":"https:\/\/codexpert.io\/blog\/wp-json\/wp\/v2\/posts\/31227\/revisions"}],"predecessor-version":[{"id":31561,"href":"https:\/\/codexpert.io\/blog\/wp-json\/wp\/v2\/posts\/31227\/revisions\/31561"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/codexpert.io\/blog\/wp-json\/wp\/v2\/media\/31250"}],"wp:attachment":[{"href":"https:\/\/codexpert.io\/blog\/wp-json\/wp\/v2\/media?parent=31227"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/codexpert.io\/blog\/wp-json\/wp\/v2\/categories?post=31227"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/codexpert.io\/blog\/wp-json\/wp\/v2\/tags?post=31227"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}