WordPress Fatal Error: Allowed memory size of 268435456 bytes exhaustedWordPress Error:

I decided to take my single topic or almost single topic websites and combine them back into one website. This all started when I setup a Mastodon account and learned about the Fediverse which then led me to writings on the IndieWeb.

I imported all of the posts from two blogs into my main website and that’s where the first error occurred.

Fatal Error

I wanted to see ALL POSTS and each time I clicked the link I started to receive this error:

Fatal error: Allowed memory size of 268435456 bytes exhausted (tried to allocate 20480 bytes) in /home/xxx/public_html/wp-includes/class-wpdb.php on line 2153

I reviewed the class-wpdb.php file and I didn’t see anything that seemed understandable. I searched for tips regarding the error and didn’t find straightforward tips, but did find something that pointed me to the php.ini settings. I increased any setting that I could change in the php.ini file. This somewhat fixed the issue of seeing ALL POSTS but it didn’t always work. I reached out to the host support and didn’t receive a satisfactory answer.


A New Start

So then I decided to just start over. I wanted to just have a new start. So I setup a new WordPress installation and wanted to export the entire set of posts from the original site and reimport them into the new site. This didn’t work. Guess what error I received from the original site?

Fatal error: Allowed memory size of 268435456 bytes exhausted (tried to allocate 20480 bytes) in /home/xxx/public_html/wp-includes/class-wpdb.php on line 2153

I did setup the new site and exported items by category or type of artifact (pages, links, etc.). Most exports worked, but I still wanted the full export. I was also receiving 0 byte export files for larger categories.

Fatal Error Fix

During this time I was testing out Mastodon and posted regarding the issue. A nice person, Zackery Fretty on Mastodon, offered the following suggestion.

Although I had already started over, I still wanted that full export and took Zackery’s advice and reached out to my hosting support again. They provided the following suggestion.

I think you can add the next line to your wp-config.php file: define( ‘WP_MAX_MEMORY_LIMIT’, ‘256M’ );

I tried it and it didn’t work at first, but then I increased the limit to 512MB and it worked! I could export all of the posts! Thank you for suggesting this Zackery!

Featured Images

Well, they didn’t import. I noticed it did work for one category but not my photography posts which are the bulk of the posts. Zackery suggested an export plugin that includes media, but that didn’t work. I think its because there were sooo many photos. I will be working on fixing this forever, but that’s OK!


I am now in the process of figuring out how I would like for this one website to work. I will one day have a business that some of the pages and a few of the posts relate to and I have them listed under a consulting section. Decisions on what to do about that will come in the future, but in the meantime I will most likely work with the page templates to give them different appearances.


Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.