WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have a custom .csv generator functions that basically export data from posts and its post metas.

The function works fine on this WP_query parameter:

[tax_query] => Array
        [0] => Array
                [taxonomy] => lot-status
                [field] => slug
                [terms] => planting
[offset] => 1000
[order] => ASC
[posts_per_page] => 500

The problem occur when I set the offset to 1500 and WordPress gives me the

Fatal error: Allowed memory size of 37748736 bytes exhausted (tried to allocate 71 bytes) in /var/www/twitgreen/htdocs/wp-includes/meta.php on line 574

fatal error notice.

I've already set the memory limit to 64M in wp-config.php.


Has anybody found (and solve, hopefully) this kind of problem? A debugging hint maybe?

share|improve this question
It's doubtful that you can override the memory_limit set in php.ini with the ini_set() command -- see stackoverflow.com/questions/1386815/… . (If you're running your own host, try changing the memory_limit in the php.ini file instead.) – Pat J Mar 25 '13 at 13:44
Look to the right under "RELATED" --> There are a lot of "memory limit" questions. – s_ha_dum Mar 25 '13 at 13:51
@PatJ, thank you for the tips. I'll ask the server guy to do that. – ifdion Mar 25 '13 at 16:18
@s_ha_dum, CMIIW, most of them are related to plugin and I haven't found one caused by a different set of queried record. – ifdion Mar 25 '13 at 16:25
Have a read of Codex: <a href="codex.wordpress.org/… memory </a>available for php. – Tara Dec 3 '14 at 17:54

I had the same issue and changing/adding WordPress Memory Limit solved it, Add the following line to wp-config.php file:

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

everything worked smoothly after adding this line.

This solution can be found on WordPress support forums

share|improve this answer
This is bad solution which should be used only as a very last resort. this means that on a VPS with 512M RAM at some point you will be able to serve only one request at a time (realistically a second) slowing your site down. – Mark Kaplun Dec 5 '13 at 10:24
@MarkKaplun +1 for this nice addition, thanks for mentioning that, do you know where i can find benchmarking that shows WP_MEMORY_LIMIT effect on overall server performance? – wdalhaj Dec 13 '13 at 0:46
you can't it depends on what do you actually do, one memory hungry admin session can kill your server, but if you never go there then your server will just keep running without any problem. I tried to explain the issue here - eng.marksw.com/2012/12/09/… – Mark Kaplun Dec 14 '13 at 5:51

Best solution is make changes on your php.ini

  1. Login to your cPanel or host panel

  2. Go to the File Manager.

  3. Select the Web root (public_html/www) directory and click Go.

  4. Find the php.ini file in the public_html.

Note! If you do not have a php.ini in your public_html files, you can have our tech support staff restore the php.ini to your public_html directory.

  1. Open the php.ini with the code editor.

Find the following section in the php.ini file.

  max_execution_time = 30
  max_input_time = 60
  memory_limit = 128M

Try increase the memory_limit value to 256M.

If the php memory_limit is already at 256M, you can increase it to 512M. Save the changes.

  1. In order for your memory limit to take effect you will need to make the php.ini recursive.
share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.