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

WordPress Trac wp-trac at lists.automattic.com
Sun Aug 5 05:15:55 UTC 2012


#21468: Custom Post Type Permalink Returns 404 Error
-------------------------+-------------------------------------------------
 Reporter:  imageac      |      Owner:
     Type:  defect       |     Status:  new
  (bug)                  |  Milestone:  Awaiting Review
 Priority:  normal       |    Version:
Component:  Permalinks   |   Keywords:  needs-patch needs-codex dev-
 Severity:  critical     |  feedback
-------------------------+-------------------------------------------------
 Hi,

 During WP 3.3.2, single-products.php was serving ' products ' custom post
 type.  Since, I upgraded WordPress version from 3.3.2 to 3.4.1, I
 discovered permalink returns 404 error on Custom post type ' products '.

 After adding following code in functions.php, it doesn't return 404 error,
 but redirect to homepage and still reluctant to serve requested content.


 {{{
 function produc_rewrite() {
     global $wp_rewrite;

     $wp_rewrite->add_permastruct('products', 'products/%postname%/', true,
 1);

     add_rewrite_rule('products/([^/]+)/?$',
 'index.php?post_type=products&postname=$matches[1]', 'top');

     $wp_rewrite->flush_rules(false); // !!!
 }
 add_action('init', 'produc_rewrite');
 }}}


 I also have tried to disable all plugin and deactivated current theme to
 default theme 'twentyeleven', but nothing fruitful.  Please assist me to
 recover my content for ' products ' custom post type.



 Regards

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


More information about the wp-trac mailing list