So it turns out the difference between the working site and the broken site was actually in the code (thank god). ‘query_var’ needs to be set to => “true”. There’s still a little funkiness, where posts with the same name (but different parents and thus different permalinks) seem like they auto direct to the earliest instance — but that’s fixable by adding a prefix in the permalink edit section of the write screen. For ease of others, here’s how I’m registering the post type:
register_post_type('book', array(
'label' => __('Books'),
'singular_label' => __('Book'),
'public' => true,
'show_ui' => true,
'_builtin' => false, // It's a custom post type, not built in!
'_edit_link' => 'post.php?post=%d',
'capability_type' => 'post',
'hierarchical' => true,
'rewrite' => array("slug" => "book"), // Permalinks format
'query_var' => false,
'supports' => array('title', 'editor', 'comments','thumbnail','page-attributes')
));
add_action( 'init', 'create_book_taxonomies', 0 );
function create_book_taxonomies() {
register_taxonomy( 'format', 'book', array( 'hierarchical' => true, 'label' =>
__('Formats', 'series'), 'query_var' => 'format' ) );
}
Cheers,
M