Support » Fixing WordPress » wp_get_archives and 3.0

  • I had a simple archives page set up pre-3.0 that worked well. It had:

    <?php wp_get_archives('type=postbypost'); ?>

    Post-upgrade, the function no longer returns anything and in fact stops the execution of the page. However, if I replace it with

    <?php wp_get_archives('type=postbypost&limit=50'); ?>

    It prints out just fine. If I put a large number like 5000, it fails again. Why doesn’t the default limit of “all” no longer work? I would like to use the “all” option because the number of posts increases fairly quickly over time.

Viewing 10 replies - 1 through 10 (of 10 total)
  • I’m not able to duplicate your problem.

    Maybe a plugin causing the problem.

    Indeed, WP Super Cache appears to be the culprit (even if upgraded to the most recent version).

    So I next tried W3 Total Cache as well and it again broke the wp_get_archives. So it seems that caching + unlimited archive listing do not agree.

    Any idea what the underlying issue could be?

    Changeset 14486 looks like it made a change with cache of wp_get_archives but can’t say why those caching programs have problems with that…

    That change is to how it caches using the object cache. WP Super Cache doesn’t have an object cache so I don’t think that is it. Perhaps a memory issue?

    Mike – any memory errors in your PHP error logs?

    Thanks for the responses. I need to set up a PHP error log on my server. I don’t think that is the problem as the site is on a dedicated server with 8Gigs of RAM. PHP’s memory settings seem ok as well:

    max_execution_time = 30     ; Maximum execution time of each script, in seconds
    max_input_time = 60	; Maximum amount of time each script may spend parsing request data
    memory_limit = 8M      ; Maximum amount of memory a script may consume (8MB)

    Will get back to you.

    Easier than I thought to set up the error log. It is a memory issue:

    [25-Jun-2010 01:48:58] PHP Fatal error: Allowed memory size of 33554432 bytes exhausted (tried to allocate 102286 bytes) in /home/REMOVED/wp-includes/general-template.php on line 1025

    So not really a bug, but I would think that 8MB would be enough. Upping it to 32MB didn’t help. Is that a unreasonable amount? There are about 1250 posts in the full postbypost output.

    Use the memory bump plugin from

    8MB is not enough for default WordPress. There are parts of WordPress core that require many times that amount. Most business installations have 96M or more that I’ve seen.



    Yes, 96MB limit got it working. The plugin didn’t help though. 96MB seems kind of ridiculous. Something about the 3.0 upgrade did something to the memory usage of wp_get_archives().

    Frederick Townes


    What I know for certain is that W3TC does not need 96M to run unless there is other code misbehaving or otherwise demanding more memory itself. There are a number of tricks you can use and probably some plugins out there that will show you the memory usage of given operations. You may want to start there.

Viewing 10 replies - 1 through 10 (of 10 total)
  • The topic ‘wp_get_archives and 3.0’ is closed to new replies.