WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Hi I've created a custom post type called shows.

here is the code for it.

add_action('init', 'show_register');

function show_register() {
        //arguments to create the post type.
        $args = array(
                'label' => __('shows'),
                'singular_label' => __('Show'),
                'public' => true,
                'show_ui' => true,
                'capability_type' => 'post',
                'hierarchical' => true,
                'has_archive' => true,
                'supports' => array('title', 'editor', 'thumbnail', 'custom-fields'),
                'rewrite' => array('slug' => 'shows', 'with_front'
                => false), );
                //Register type and custom taxonomy for type.
                register_post_type( 'shows' , $args );

                register_taxonomy("Show-type", array("shows"),
                array("hierarchical" => true, "label" => "Show
                Types", "singular_label" => "Show Type", "rewrite"
                => true, "slug" => 'show-type'));

I've created 2 files that follow accordingly to the wordpress hierarchy and called them archive-shows.php and single-shows.php. These should automatically link to the correct pages however for some reason they both default back to index.php.

The normal single.php and archive.php work as normal.

Fix's tried Permalinks Flushed has archive = true

please any suggestions.

share|improve this question
Maybe your templates should be using the slug you registered for the post type? eg. show-type. – t31os May 10 '13 at 12:03
Isn't that the taxonomy type? – Dannyw24 May 10 '13 at 12:04
Oh yes, my mistake.. glanced over that way too fast. – t31os May 10 '13 at 12:05
still got no fix at all – Dannyw24 May 10 '13 at 12:23
Browser cache issue? – ebohlman May 13 '13 at 6:27
up vote 3 down vote accepted

You have to flush your permalinks after you register these things. There are ways to do that automatically but the quick and dirty way is to browse to wp-admin->Settings->Permalinks and click "Save Changes". That will work fine if this is your site and you aren't distributing a plugin. If this is a plugin (which it probably should be), you can run flush_rewrite_rules(); on the plugin's activation hook. An example of doing that from the Codex:

function myplugin_activate() {
    // register taxonomies/post types here

register_activation_hook( __FILE__, 'myplugin_activate' );

function myplugin_deactivate() {
register_deactivation_hook( __FILE__, 'myplugin_deactivate' );

Other than that, I did not have any issue with your code (copied un-altered). The CPT registered and both single-shows.php and archive-shows.php worked after flushing the permalinks.

share|improve this answer
did this answer your question, @Dannyw24 ? – tacudtap Jul 17 '15 at 20:38

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.