How to Change WordPress Memory Limit Step-by-Step?

Struggling with WordPress memory issues? Discover simple, step-by-step methods to increase your memory limit and boost site performance. Learn how to fix it now!

  • Updated on: August 19, 2024

Wasim Akram

Blog Author

WPnomy - Default Featured Image


If you’re running a WordPress site, you might have encountered issues related to insufficient memory.

These issues can cause your website to slow down or even crash, impacting both user experience and your site’s performance.

Fortunately, increasing the memory limit for your WordPress site can often resolve these problems.

In this post, I’ll guide you through four methods to change your WordPress memory limit, helping you keep your site running smoothly.

Editing wp-config.php

One of the most effective ways to increase your WordPress memory limit is by editing the wp-config.php file.

This method is preferred because it directly targets WordPress’s memory allocation without affecting other applications on your server.

Here’s a step-by-step guide:

  1. Access Your WordPress Files
    Use an FTP client or your hosting provider’s file manager to access your WordPress files.
  2. Locate the wp-config.php File
    Find the wp-config.php file in the root directory of your WordPress installation.
  3. Edit the wp-config.php File
    Open the file for editing. Look for the line that says /* That's all, stop editing! Happy blogging. */.
  4. Add the Memory Limit Code
    Above that line, add the following code to increase the memory limit:
   define( 'WP_MEMORY_LIMIT', '256M' );

Replace 256M with the amount of memory you wish to allocate (e.g., 128M or 512M).

  1. Save Your Changes
    Save the wp-config.php file and upload it back to your server.

Editing .htaccess File

If you can’t access or edit the wp-config.php file, you might use the .htaccess file instead.

This file controls server configurations, so be cautious as changes can affect other applications on your server.

  1. Access the .htaccess File
    Use your FTP client or file manager to locate the .htaccess file. If it’s hidden, enable the “show hidden files” option.
  2. Edit the .htaccess File
    Open the file for editing. Add the following line at the beginning of the file:
   php_value memory_limit 256M

Replace 256M with your desired memory limit.

  1. Save Your Changes
    Save and upload the .htaccess file back to your server.

Editing PHP.ini File

Another method to increase your memory limit is by editing the PHP.ini file. This approach affects the PHP configuration for your entire server, not just WordPress.

It’s a good option if you manage multiple PHP applications.

  1. Access the PHP.ini File
    Depending on your hosting provider, you might be able to access and edit the PHP.ini file directly through their control panel or via FTP.
  2. Locate the memory_limit Line
    Find the line in the PHP.ini file that reads memory_limit = 32M (or a similar value).
  3. Change the Memory Limit
    Modify the value after the = sign to your desired memory limit:
   memory_limit = 256M
  1. Save the File
    Save your changes. Be aware that some servers may require a restart for the changes to take effect.

Contacting Your Hosting Provider

If you find that none of the above methods work or if you’re unsure about making these changes yourself, contacting your hosting provider is a wise choice.

They can advise you on server limitations and may be able to increase the memory limit for you.

Important Considerations

Before increasing your memory limit, it’s essential to understand why you’re encountering memory issues.

Sometimes, optimizing plugins and themes can resolve memory problems without needing to increase the limit.

Also, keep in mind that server limitations might restrict the effectiveness of your changes.

Be cautious when setting a very high memory limit, as it can impact server performance.

Conclusion

In conclusion, adjusting the WordPress memory limit can help resolve performance issues and improve your site’s speed.

Whether you choose to edit the wp-config.php, .htaccess, or PHP.ini files, or reach out to your hosting provider, each method has its own set of considerations.

What challenges have you faced when trying to manage WordPress memory limits?

I’d love to hear about your experiences and any solutions you’ve found. Feel free to share your thoughts in the comments below!

For more tips and guides on optimizing your WordPress site, explore our other blog articles related to WordPress.

Your journey to mastering WordPress doesn’t have to end here!

0 0 votes
Article Rating
Subscribe
Notify of
guest
0 Comments
Most Voted
Newest Oldest

Related Posts You’ll Love

Keep exploring and sharpen your WordPress skills with more expert guides, tips, and inspiration tailored just for you. Each post is carefully crafted to help you build faster, solve real-world challenges, and get the most from WP.

Explore More Posts
Next Bricks - Featured Image - WPnomy

Next Bricks Review: Worth It for Bricks Builder Developers?

Next Bricks adds 50+ unique elements, GSAP animations, and Barba.js page transitions to Bricks Builder. Honest review after testing and community research.

Read Now
Oxyfolio Review - Featured Image - WPnomy

Oxyfolio Review (2026): The Best Elements Addon for Oxygen 6?

Oxyfolio adds 120 unique elements to Oxygen 6 with a one-time €119 payment. Here's my honest review after testing it, including where it shines and who should skip it.

Read Now
WPnomy - Default Featured Image

Best Breakdance Templates (2026): Design Sets & Libraries

Handpicked Breakdance template kits, design sets, and block libraries reviewed for 2026. Free options, pricing, and clear ratings to help agencies and developers pick the right one fast.

Read Now
  • Connect. Learn. Build Together.

    Become part of the WPnomy family; a vibrant, supportive community where freelancers, designers, and agencies come together to share insights, ask questions, and celebrate wins. Here, you’ll find encouragement, real-world tips, and a network of passionate WordPress users ready to help you grow.

    Join Facebook Community
    • Connect with passionate WordPress users who share your goals and challenges.
    • Access practical tips, insider tricks, and real-world solutions tailored for all skill levels.
    • Share your progress, get feedback, and celebrate your wins with a supportive network.
    • Stay updated on the latest WordPress features, tutorials, and community events.
    • Experience friendly mentorship and no-fluff guidance, making web building easier and more fun.
    WordPress Support - SyncWin Media - Featured Image

    Need WordPress Help? We’re Just One Message Away.

    Whether your site is slow, broken, outgrowing its current setup, or you just need someone reliable to handle the technical side of WordPress, we cover it all, end-to-end.

    Get Your Free WordPress Audit