Increasing WordPress memory limit

31 August, 2016

My dads blog recently hit a snag where the front end was not loading completely. It would run and load for 11-12s and then stop. For his blog page at this point in time that meant it loaded the header, the menu, and about half of his first blog post. The blog was using WordPress 4.6 with the Dazzling theme. Below are the steps I followed to solve the problem.

  1. Deactivated all of his plugins then started activating them one by one to see which was the problem. It turned out that the issue was with NextGen. Dad's blog hosts about 2 GB of images and NextGen is what he uses to organize and display them. In the past I tested the blog to see what eats the most memory and NextGen won by a mile, so this was not a complete surprise.

  2. I would like a longer term, more robust solution to this problem but before that the blog has to be working. I mounted his server (sshfs) and edited the wp-config file, adding:

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

    This allows scripts to use up to 256 MB of memory as opposed to the default 64 MB (I think that's the number anyhow).

  3. Cleared cache and refreshed the front end.

Like I said, a more robust solution will be needed since this slows down the site, but at least he's up and running!