Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

Trying to get a post to show up at http://beernews.org/supporter/rare-beer-club/ but am getting 404 instead. An example of what the page should look like is: http://beernews.org/brewery/5-rabbit-brewery/. When I do a search, it shows up as an excerpt in the results. Just can't get the template single-supporter.php to trigger for some reason. I have set up the post type (And corresponding taxonomy) exactly like every other post type and taxonomy.

I have flushed the cache and CDN.

I don't have a live server testing environment for this but the same exact code works on localhost. Because it is live with heavy traffic, I am reluctant to turn on debugging features that would show on front end.

Register post type code in functions.php

  $labels = array(
    'name' => _x('Supporters', 'post type general name'),
    'singular_name' => _x('Supporter', 'post type singular name'),
    'add_new' => _x('Add New', 'supporter'),
    'add_new_item' => __('Add New Supporter'),
    'edit_item' => __('Edit Supporter'),
    'new_item' => __('New Supporter'),
    'all_items' => __('All Supporters'),
    'view_item' => __('View Supporter'),
    'search_items' => __('Search Supporters'),
    'not_found' =>  __('No supporters found'),
    'not_found_in_trash' => __('No supporters found in Trash'), 
    'parent_item_colon' => '',
    'menu_name' => 'Supporters'

  );
  $args = array(
    'labels' => $labels,
    'public' => true,
    'publicly_queryable' => true,
    'show_ui' => true, 
    'show_in_menu' => true, 
    'query_var' => true,
    'rewrite' => true,
    'capability_type' => 'post',
    'has_archive' => true, 
    'hierarchical' => true,
    'menu_position' => null,
    'taxonomies' => array ('beer','category'),
    'supports' => array('title','editor','author','thumbnail','excerpt','trackbacks','custom-fields','page-attributes','revisions','comments','post-formats')
  ); 
  register_post_type('supporter',$args);

Register taxonomy code in functions.php

   // Add new taxonomy, make it hierarchical (like categories)
  $labels = array(
    'name' => _x( 'Supporters', 'taxonomy general name' ),
    'singular_name' => _x( 'Supporter', 'taxonomy singular name' ),
    'search_items' =>  __( 'Search Supporters' ),
    'all_items' => __( 'All Supporters' ),
    'parent_item' => __( 'Parent Supporter' ),
    'parent_item_colon' => __( 'Parent Supporter:' ),
    'edit_item' => __( 'Edit Supporter' ), 
    'update_item' => __( 'Update Supporter' ),
    'add_new_item' => __( 'Add New Supporter' ),
    'new_item_name' => __( 'New Supporter Name' )
  );

  register_taxonomy('supporter',array('beer','post'),
    array(
    'hierarchical' => true,
    'labels' => $labels,
    'show_ui' => true,
    'query_var' => true,
    'rewrite' => array( 'slug' => 'supporters-bp' )
  ));
share|improve this question
add comment

1 Answer

Nevermind. For some reason, I had to go to my permalinks page and click 'Save Changes' for this to show up. It is bewildering.

share|improve this answer
    
I think that flushes the rewrite options in your htaccess. Every time that you add something like a new post type you have to do this or use add_action('admin_init', 'flush_rewrite_rules'); in order to flush the cache rewrite rules. ( from codex.wordpress.org/Custom_Queries ) –  Álex Acuña Viera Sep 7 '11 at 21:32
3  
Important note, if adding to hook, that rules should be flushed once after changes. –  Rarst Nov 8 '11 at 20:13
add comment

Your Answer

 
discard

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.