WordPress “Fatal error: Allowed memory size of n bytes exhausted (tried to allocate x bytes) in …”

This one took me a while to figure out…

Clicking the “Appearance” then “Customize” options from the WordPress Dashboard suddenly started yielding this error on a site I was working on with a fairly detailed theme:

“Fatal error: Allowed memory size of n bytes exhausted (tried to allocate x bytes) in …”

Replace ‘n‘ and ‘x‘ with what you are seeing.

Here’s how I fixed it after trying to update the php5.ini file had no effect (this site is hosted by GoDaddy):

Modify your wp_config.php file by adding these two lines at the top of the file, just before your database settings:

define( ‘WP_MEMORY_LIMIT’, ’96M’ );
define( ‘WP_MAX_MEMORY_LIMIT’, ‘256M’ );

// ** MySQL settings – You can get this info from your web host ** //
/** The name of the database for WordPress */
define(‘DB_NAME’, ‘abcXXXXXXXX’);

That immediately fixed my issue.