Forward slash in custom taxonomy rewrite causes 404s because of (unnecessary?) attachment rule
|Reported by:||harikaram||Owned by:|
I implement a custom taxonomy with a rewrite that is designed to create urls like:
$name = 'apps'; register_taxonomy($name.'-tag', $name.'-post', array( 'label' => ucfirst($name) . ' Tags', 'public' => true, 'has_archive' => true, 'hierarchical' => false, 'update_count_callback' => '_update_post_term_count', 'rewrite' => array('slug' => "$name/about", with_front=>true) ));
However I was getting a 404 (yes I was flushing the rules) unless I changed the '/' to say a '-'. Upon inspection of the rules, I found this one whose precedence was causing the problem:
'apps/[^/]+/([^/]+)/?$' => 'index.php?attachment=$matches'
Upon removing it inside the "rewrite_rules_array" hook, the problem was solved.
It seems odd to me that this generic rule exists and rewrites to an attachment of all things...