WordPress.org

Forums

404 errors only on *some* monthly pages of custom post type archive (4 posts)

  1. aprilnm
    Member
    Posted 2 years ago #

    I have been trying to figure out the strangest error for two days and I'm out of ideas. Here's hoping somebody else has seen and solved this:

    I have custom post type for news on my site at http://scalingupnutrition.org/news. As you can see there are posts there from every month starting in September 2012. If you click the monthly archive link (bottom right column) for September or October, it works beautifully. But clicking those same archive links for November/December/January returns a 404. There's content that should be showing there (and anyway if it was an empty archive it wouldn't return that 404 page).

    I've tried the following to no avail:

    • Reverting to default permalinks and then restoring my custom permalink structure (/%category%/%postname%).
    • Wiping my .htaccess and replacing it with the WordPress default.
    • Edits to the archive loop, but none of them changed anything except the pages that are already working.

    I'm wondering if maybe somehow the wp_query parameter of monthnum is somehow not registering for months after October. Because here's the relevant snippet from the archives loop:

    `else {
    if(!empty($wp->query_vars['monthnum'])){
    $args = array(
    'post_type' => 'news',
    'post_status' => 'publish',
    'year' => $wp->query_vars['year'],
    'monthnum' => $wp->query_vars['monthnum'],
    'posts_per_page' => nss_get_setting('numbernewspage'),
    'paged' => empty($paged)?1:$paged

    );
    }else{
    $args = array(
    'post_type' => 'news',
    'post_status' => 'publish',
    'posts_per_page' => nss_get_setting('numbernewspage'),
    'paged' => empty($paged)?1:$paged

    );
    }`

    [Please do not bump]

  2. mdj101
    Member
    Posted 2 years ago #

    What happens if you create a new article for one of the months that doesn't work. (change the timestamp)

  3. aprilnm
    Member
    Posted 2 years ago #

    It still returns the same error. I thought maybe it was the content too but putting content from October into January and removing the current January content, for example, doesn't change things.

  4. mdj101
    Member
    Posted 2 years ago #

    Strange, as stumped as I am with my error!

Topic Closed

This topic has been closed to new replies.

About this Topic