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.

I have Three Custom post Types and one Custom Taxonomy and some pages. The Custom taxonomy is register with one of the post type. The problem is When the default Permalink is enable it works for all pages, custom post types and taxonomies. But when the "Post name" or any other permalink enable it breaks the pages structure, and the rest of links are working fine.

After Register the post types and taxonomies i use flush_rewrite_rules() but its not working.

Please help me in this situation.

add_action("after_setup_theme","rg_menus"); 
function rg_menus(){
    register_nav_menus(array(       
        'header'=> "Primary Menu",
        'footer'=> "Footer Menu",
        'header_menu'=>'Top Menu'
    ));

    add_theme_support("post-thumbnails");
    add_image_size("home_header",1517,516,true);
    add_image_size("page_headers",1517,259,true);

    create_product();
    create_product_category();

    }
/*===============================*/ 
/* P-Riopel Product */  
function create_product(){
   register_post_type('priopel_products', array(    'label' => 'PRiopel Products','description' => '','public' => true,'show_ui' => true,'show_in_menu' => true,'capability_type' => 'post','hierarchical' => false,'rewrite' => array('slug' => 'product'),'query_var' => true,'has_archive' => true,'exclude_from_search' => false,'supports' => array('title','editor','excerpt','trackbacks','custom-fields','thumbnail','author','page-attributes',),'taxonomies' => array('priopel_cat',),'labels' => array (
  'name' => 'PRiopel Products',
  'singular_name' => 'PRiopel Product',
  'menu_name' => 'PRiopel Products',
  'add_new' => 'Add Product',
  'add_new_item' => 'Add New Product',
  'edit' => 'Edit',
  'edit_item' => 'Edit Product',
  'new_item' => 'New Product',
  'view' => 'View Product',
  'view_item' => 'View Product',
  'search_items' => 'Search Products',
  'not_found' => 'No Products Found',
  'not_found_in_trash' => 'No Products Found in Trash',
  'parent' => 'Parent Product',
),) );  
    }
/*===============================*/     
/* P-Riopel Product Category */     
function create_product_category(){
    register_taxonomy('priopel_cat',
      array ('priopel_products',
                    ),array( 'hierarchical' => true, 
                             'public' => true,  
                             'label' => 'Categories',
                             'show_ui' => true,
                             'query_var' => true,
                             'rewrite' => array('slug' => '','with_front' => true,'hierarchical'=>true),
                             'singular_label' => 'Category') );
            }   
share|improve this question
    
Please add some code snippets to demonstrate how you are registering your custom post types and taxes. –  Brian Fegter Sep 14 '12 at 3:41
    
Thank you for your response on my question. Please view the link to see the code. mksols.com/code_snippet.txt. I actually figure out that when i tried to register the my custom taxonomy to the custom post type it creates problem for the permalink. –  user19694 Sep 15 '12 at 4:57
add comment

1 Answer 1

after_setup_theme is the wrong action to register post types. See register_post_type in Codex:

Do not use register_post_type before init.

share|improve this answer
    
No Brian Its not working :(. Still Page Not Found Error. As you told me that not to use after_setup_theme hook to register the custom post type. I wrote the code under "init" hook, and re-save the permalinks. I have updated my recent code to above link in code_snippet.txt file kindly check it again. –  user19694 Sep 17 '12 at 7:59
    
your product category rewrite slug should not be empty, also don't flush rewrite rules on every request –  Milo Sep 17 '12 at 14:10
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.