404 errors only on *some* monthly pages of custom post type archive
-
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 https://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]
- The topic ‘404 errors only on *some* monthly pages of custom post type archive’ is closed to new replies.