has_archive=false on the default post type

Late answer.


has_archive applies only for the rewrite arguments.

In Detail

If has_archive is set to true, then the $archive_slug will get set to the rewrite['slug'] argument. If then a rewrite['with_front'] arg is set, then this one will get prepended. The result of this will then get added as rewrite rule:

add_rewrite_rule( "{$archive_slug}/?$", "index.php?post_type=$post_type", 'top' );

If feeds are set to true and has_archive also, then you’ll also get rewritten rules for feeds:

add_rewrite_rule( "{$archive_slug}/feed/$feeds/?$", "index.php?post_type=$post_type" . '&feed=$matches[1]', 'top' );
add_rewrite_rule( "{$archive_slug}/$feeds/?$", "index.php?post_type=$post_type" . '&feed=$matches[1]', 'top' );

The same principle applies for rewrite['pages']:

add_rewrite_rule( "{$archive_slug}/{$wp_rewrite->pagination_base}/([0-9]{1,})/?$", "index.php?post_type=$post_type" . '&paged=$matches[1]', 'top' );

Summed up:

If you ain’t got has_archive set to true, then any try to add rewrites for feeds, pages or archives will end up with a big ?.

Leave a Comment