[wp-trac] [WordPress Trac] #21417: Custom Post Type Permalink Returns 404 Error

WordPress Trac wp-trac at lists.automattic.com
Mon Jul 30 02:11:54 UTC 2012


#21417: Custom Post Type Permalink Returns 404 Error
--------------------------+-------------------------------------
 Reporter:  imageac       |      Owner:
     Type:  defect (bug)  |     Status:  new
 Priority:  normal        |  Milestone:  Awaiting Review
Component:  Permalinks    |    Version:  3.4.1
 Severity:  critical      |   Keywords:  needs-patch needs-codex
--------------------------+-------------------------------------
 Since, I upgraded Wordpress version from 3.3.2 to 3.4.1, I discovered
 permalink returns 404 error on (1) Paged categories, and (2) Custom type
 posts.

 The paged categories has been fixed implementing ticket:21209, but custom
 type posts return 404 error when it called.

 I am using following code to register custom type post 'products'.


 {{{
 function products_register() {



         $labels = array(
                 'name' => _x('Products', 'post type general name'),
                 'singular_name' => _x('Product', 'post type singular
 name'),
                 'add_new' => _x('Add New', 'product item'),
                 'add_new_item' => __('Add New Product'),
                 'edit_item' => __('Edit Product'),
                 'new_item' => __('New Product'),
                 'view_item' => __('View Product'),
                 'search_items' => __('Search Product'),
                 'not_found' =>  __('Nothing found'),
                 'not_found_in_trash' => __('Nothing found in Trash'),
                 'parent_item_colon' => ''
         );



         $args = array(
                 'labels' => $labels,
                 'public' => true,
                 'publicly_queryable' => true,
                 'show_ui' => true,
                 'query_var' => true,
 // working perfect in 3.3.2             'rewrite' => true,
 // also tried this in 3.4.1             'rewrite' => array('slug' =>
 'products','with_front' => FALSE),
                 'rewrite' => array('slug' => 'products'),
                 'capability_type' => 'post',
                 'hierarchical' => false,
                 'can_export' => true,
                 'menu_position' => 5,
                  'taxonomies' => array('category'),
                 'supports' => array('title','editor','thumbnail', 'custom-
 fields')
           );



         register_post_type( 'products' , $args );

 }



 //Registering Post-Type Products for Affiliate products only

 add_action('init', 'products_register');





 function add_default_boxes() {

     register_taxonomy_for_object_type('category', 'products');

 }

 //Registering Taxonomy for Products post-type

 add_action('init', 'add_default_boxes');


 }}}

-- 
Ticket URL: <http://core.trac.wordpress.org/ticket/21417>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list