[wp-trac] [WordPress Trac] #10446: Permalinks for custom taxonomies does not work

WordPress Trac wp-trac at lists.automattic.com
Sun Jul 19 07:02:59 UTC 2009


#10446: Permalinks for custom taxonomies does not work
--------------------------+-------------------------------------------------
 Reporter:  sirzooro      |       Owner:  ryan       
     Type:  defect (bug)  |      Status:  new        
 Priority:  normal        |   Milestone:  2.8.2      
Component:  Permalinks    |     Version:  2.8.1      
 Severity:  normal        |    Keywords:  needs-patch
--------------------------+-------------------------------------------------
 The code:
 {{{
 class TestPlugin {
         function TestPlugin() {
                 add_action( 'init', array( &$this, 'init' ) );
         }

         function init() {
                 register_taxonomy( 'mytax', 'post', array('label' => 'My
 Tax',
                         'query_var' => false, 'rewrite' => true  ) );
         }
 }

 $wp_test_plugin = new TestPlugin();
 }}}
 This plugin registers new taxonomy. It appears in Menu and on Edit Post
 page. Assigned values are also displayed by `the_taxonomies()`. One thing
 which does not work are permalinks. WP generates URLs like
 `http://wordpress.local/mytax/test/`, but they don't work - error 404.
 What's more, it looks that rewriting rules are registered correctly. I
 tried to call `$wp_rewrite->rewrite_rules()` just after registering
 taxonomy, and new rules are in place as expected:
 {{{
   'mytax/([^/]+)/feed/(feed|rdf|rss|rss2|atom)/?$' => string
 'index.php?taxonomy=mytax&term=$1&feed=$2' (length=40)
   'mytax/([^/]+)/(feed|rdf|rss|rss2|atom)/?$' => string
 'index.php?taxonomy=mytax&term=$1&feed=$2' (length=40)
   'mytax/([^/]+)/page/?([0-9]{1,})/?$' => string
 'index.php?taxonomy=mytax&term=$1&paged=$2' (length=41)
   'mytax/([^/]+)/?$' => string 'index.php?taxonomy=mytax&term=$1'
 (length=32)
 }}}

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


More information about the wp-trac mailing list