Create an archive page for custom post type with custom taxonomy

Good news – there’s nothing you need to do. WordPress does this for you out of the box, providing you have set up your post type and taxonomy to do so.

You should be able to access your posts at http://example.com/labels/events, once you’ve checked:

  • that your post type is publicly_queryable (either the public argument or publicly_queryable argument is set to true by your register_post_type() call),
  • your taxonomy slug isn’t set to something different (in the rewrite -> slug argument of your register_taxonomy() call), and
  • your permalinks have been flushed since the post type and taxonomy were registered (to flush permalinks, just visit Settings -> Permalinks and click Save).

There’s a few other things you may want to look into as well, including:

  • the rewrite -> with_front argument sent to register_taxonomy(), which defines whether your default permalink base should be included (eg. some people use ‘/blog’ before all permalinks),
  • whether you, or any plugins you’re running, have any other custom rewrites set up (i.e. calls to add_rewrite_rule()) – these might change the default behaviour, and
  • whether the strongly recommended call to register_taxonomy_for_object_type() has been made after the call to register_taxonomy(),
  • and whether all of this is happening within the init action.

If this isn’t working for you, there may be another argument that is changing the default behaviour; in which case you could always edit your question to add your post type & taxonomy registration code.