Sign up ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I know this question was brought up before, but I can't seem to get things working using any of the proposed solutions. This is how I have my custom post types and categories setup:

Custom Post Type: Buildings
-Buildings Categories:

-Buildings Regions (custom taxonomy):
---New Jersey
---New York

Every Building will be assigned to 1 building category (Medical, Industrial, etc) and 1 building region (USA->New York, Canada->Ontario, etc). This all works fine, except the permalinks to inner building pages are and there is no category archive for the custom post type categories. Here is what I'm trying to achieve:

  1. Permalinks to inner building pages to be

  2. Permalink to archive of all building pages to be

  3. Permalinks to archives of each building category

  4. Lastly I want to be able to display an archive of buildings by region. So would bring up all the buildings in the USA, while would bring up only buildings in Quebec, Canada.

I've tried numerous solutions, but the closest I was able to get was half of #1 working using the WP Permastructure plugin posted as an answer to this similar thread. I am able to get the permalinks for inner building pages to generate properly, but when accessed they return 404s.

Any help is greatly appreciated!

share|improve this question

1 Answer 1

Yev, without a code sample to work from I'm not sure how helpful I can be but I'll give you the code that I use for creating Custom Post Types with a archive page. This example will get you started for an FAQ (easily modified).

Note the rewrite lines and the flush, which is what creates a permalink structure for the Custom Post Types (and flushes the cache to activate it). I suspect this will get you fairly close to what you're hoping for but if not, submit your code and I'll try to help.

if ( ! function_exists( 'new_cpt_faq' ) ) {
    function new_cpt_faq() {
        register_post_type( 'new_cpt_faq',
                'labels' => array(
                    'name' => __( 'FAQs', 'name_space'  ),
                    'singular_name' => __( 'FAQ', 'name_space'  ),
                    'add_new' => __( 'Add New FAQ', 'name_space'  ),
                    'add_new_item' => __( 'Add New FAQ', 'name_space'  ),
                    'edit_item' => __( 'Edit FAQ', 'name_space'  ),
                    'new_item' => __( 'New FAQ', 'name_space'  ),
                    'all_items' => __( 'All FAQs', 'name_space'  ),
                    'view_item' => __( 'View FAQ', 'name_space'  ),
                    'search_items' => __( 'Search FAQs', 'name_space'  ),
                    'not_found' =>  __( 'No FAQs found', 'name_space'  ),
                    'not_found_in_trash' => __( 'No FAQs found in Trash', 'name_space'  ),
                    'parent_item_colon' => '',
                    'menu_name' => __( 'FAQs', 'name_space'  )
            'public' => true,
            'has_archive' => true,
            'supports' => array( 'title', 'editor' ),
            'rewrite' => array(
                            'with_front'=> false,
                            'feed'=> true,
                            'pages'=> true

add_action( 'init', 'new_cpt_faq' );

if ( ! function_exists( 'new_cpt_faq_taxonomy_categories' ) ) {
    function new_cpt_faq_taxonomy_categories() {
            'labels' => array(
            'name' => __( 'FAQ Category', 'name_space'  ),
            'add_new_item' => __( 'Add New FAQ Category', 'name_space'  ),
            'new_item_name' => __( 'New FAQ Category', 'name_space' )
            'show_ui' => true,
            'show_tagcloud' => true,
            'hierarchical' => true
add_action( 'init', 'new_cpt_faq_taxonomy_categories' );

share|improve this answer
Thanks for your reply! How would you modify the code though to have archive pages for different FAQ categories? – Yev Feb 23 '13 at 21:09

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.