Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

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

1 Answer 1

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

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.