﻿id,summary,reporter,owner,description,type,status,priority,milestone,component,version,severity,resolution,keywords,cc
15239,register_post_type rewrite argument breaks template hierarchy,croakingtoad,,"I have been working on this issue for days and have discovered, that when using template hierarchy for custom post types, for example, a CPT of 'sets' would use single-sets.php as a template page.  This works fine, except when the CPT is called 'lego-sets' and you rewrite it to 'sets' then the template hierarchy ""breaks"" and WP resorts to single.php or some other generic file in the template hierarchy.

Doesn't work because of the rewrite with template hierarchy:
{{{
add_action('init','create_post_types');
function create_post_types() {
	$sets_labels = array(
		'name' 				=> __('LEGO Sets','post type general name'),
		'singular_name' 	=> __('LEGO Set','post type singular name'),
		'add_new'			=> __('Add New','sets'),
		'add_new_item'		=> __('Add New LEGO Set'),
		'edit_item'			=> __('Edit LEGO Set'),
		'new_item'			=> __('New LEGO Set'),
		'view_item'			=> __('View LEGO Set'),
		'search_items'		=> __('Search LEGO Sets'),
		'not_found'			=> __('No LEGO Sets found'),
		'not_found_in_trash' => __('No LEGO Sets found in Trash'),
		'parent_item_colon'	=> ''
	);
	$sets_args = array(
		'labels' 				=> $sets_labels,
		'public'				=> true,
		'publicly_queryable'	=> true,
		'show_ui'				=> true,
		'query_var'				=> true,
                // this is the problem line, if you set it to just true or false it's fine, but if you add the array and slug it breaks
		'rewrite'				=> array('slug' => 'sets', 'with_front' => false),
		'capability_type'		=> 'post',
		'hierarchical'			=> false,
		'menu_position'			=> null,
		'supports'				=> array('title','editor','author','thumbnail','excerpt','comments')
	);
	$sets = register_post_type('lego-sets', $sets_args);
}}}

",defect (bug),closed,normal,,Post Types,3.0.1,normal,invalid,register_post_type,
