WordPress monthly archive links result in 404

It looks like you need to add your news custom post type to the query for archive pages (I had the same problem).

Codex: custom post types to query

Add this code to your functions

    // Show posts of 'post', and 'news' post types on archive page
add_action( 'pre_get_posts', 'add_my_post_types_to_query' );

function add_my_post_types_to_query( $query ) {
    if ( is_archive() && $query->is_main_query() )
        $query->set( 'post_type', array( 'post', 'news' ) );
    return $query;
}

Just check that your admin post listings are not affected.

Leave a Comment