Support » Fixing WordPress » Unexpected “0” month in wp_get_archives() output

  • Resolved Raam Dev


    My archives page uses the wp_get_archives() function to create a drop-down box that lists each of the months for my archives.

    <?php wp_get_archives('type=monthly&format=option&show_post_count=0'); ?>

    It works fine, except for the fact that the very last entry is a “0” (that’s a zero):

    April 2010
    March 2010
    February 2010
    January 2010
    December 2010

    Selecting the zero always links to the current month’s archive. Any idea what’s causing this?

Viewing 3 replies - 1 through 3 (of 3 total)
  • Try taking out &show_post_count=0. Since false is the default you should not need that argument to be there at all.

    Use phpMyAdmin and look at your posts table, then sort your posts by clicking on the post_date column–going to guess there’s a post in there with a bad or blank date.

    Thanks MichaelH! That was the problem. One of the posts had a date of 0000-00-00 00:00:00.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Unexpected “0” month in wp_get_archives() output’ is closed to new replies.