title: Can I create custom post type archives with meta values rather than categories?
body: <p>Unlike the usual Wordpress blog archives which work from categories, I have a custom post type which uses a global meta key and values to link these posts with pages in my site.</p>
  
  <p>I want to create an archive, exactly like the category archives on the blog but to work with these meta values.</p>
  
  <p>What's the best way to do this, using the custom WP query, and keeping pagination, but whilst also achieving the correct archive URLs?</p>
  
  <pre><code>function bv_patient_stories_init() {
          register_post_type('patient-story', array(
              'labels'          =&gt; array(
                  'name'               =&gt; 'Patient Stories',
                  'singular_name'      =&gt; 'Patient story',
                  'add_new'            =&gt; 'Add new',
                  'add_new_item'       =&gt; 'Add a new Patient Story',
                  'edit_item'          =&gt; 'Edit Patient Story',
                  'new_item'           =&gt; 'New Patient Stories',
                  'all_items'          =&gt; 'All Patient Stories',
                  'view_item'          =&gt; 'View Patient Story',
                  'search_items'       =&gt; 'Search Patient Stories',
                  'not_found'          =&gt; 'No Patient Stories have been added',
                  'not_found_in_trash' =&gt; 'No Patient Stories in bin',
                  'parent_item_colon'  =&gt; '',
                  'menu_name'          =&gt; 'Patient Stories'
              ),
              'description'     =&gt; 'Patient case study',
              'public'          =&gt; true,
              'show_ui'         =&gt; true,
              'show_in_menu'    =&gt; true,
              'query_var'       =&gt; true,
              'rewrite'         =&gt; array('slug' =&gt; 'patient-stories', 'with_front' =&gt; false),
              'capability_type' =&gt; 'post',
              'has_archive'     =&gt; true,
              'hierarchical'    =&gt; false,
              'menu_position'   =&gt; 57,
              'supports'        =&gt; array('title', 'revisions', 'thumbnail', 'excerpt', 'custom-fields', 'comments'),
              'menu_icon'       =&gt; 'dashicons-id',
          ));
      }
  </code></pre>